proxylogin

package
v0.0.0-...-8aeb11b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package proxylogin implements alogin.Login when letting a reverse proxy handle authentication.

Index

Constants

View Source
const (
	// DefaultLoginURL is the default URL to use for logging in.
	DefaultLoginURL = "https://skia.org/login/"

	// DefaultLogoutURL is the default URL to use for logging out.
	DefaultLogoutURL = "https://skia.org/logout/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ProxyLogin

type ProxyLogin struct {
	// contains filtered or unexported fields
}

ProxyLogin implements alogin.Login by relying on a reverse proxy doing the authentication and then passing the user's logged in status via header value.

See https://grafana.com/docs/grafana/latest/auth/auth-proxy/ and https://cloud.google.com/iap/docs/identity-howto#getting_the_users_identity_with_signed_headers

func New

func New(headerName, emailRegex string) (*ProxyLogin, error)

New returns a new instance of proxyLogin.

headerName is the name of the header that contains the proxy authentication information.

emailRegex is a regex to extract the email address from the header value. This value can be nil. This is useful for reverse proxies that include other information in the header in addition to the email address, such as https://cloud.google.com/iap/docs/identity-howto#getting_the_users_identity_with_signed_headers

If supplied, the Regex must have a single subexpression that matches the email address.

func NewWithDefaults

func NewWithDefaults() *ProxyLogin

NewWithDefaults calls New() with reasonable default values.

func NewWithDomain

func NewWithDomain() *ProxyLogin

func (*ProxyLogin) HasRole

func (p *ProxyLogin) HasRole(r *http.Request, wantedRole roles.Role) bool

HasRole implements alogin.Login.

func (*ProxyLogin) LoggedInAs

func (p *ProxyLogin) LoggedInAs(r *http.Request) alogin.EMail

LoggedInAs implements alogin.Login.

func (*ProxyLogin) LoginURL

func (p *ProxyLogin) LoginURL(r *http.Request) string

LoginURL implements alogin.Login.

func (*ProxyLogin) NeedsAuthentication

func (p *ProxyLogin) NeedsAuthentication(w http.ResponseWriter, r *http.Request)

NeedsAuthentication implements alogin.Login.

func (*ProxyLogin) Roles

func (p *ProxyLogin) Roles(r *http.Request) roles.Roles

Roles implements alogin.Login.

func (*ProxyLogin) Status

func (p *ProxyLogin) Status(r *http.Request) alogin.Status

Status implements alogin.Login.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL