authenticators

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicAuth

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

BasicAuth is an authenticator that authenticates an user with the given username.

func NewBasicAuth

func NewBasicAuth(store auth.IdentityStore, validator BasicAuthValidator) *BasicAuth

NewBasicAuth returns an instance of BasicAuth authticator.

func NewBasicAuthRealm added in v0.3.0

func NewBasicAuthRealm(store auth.IdentityStore, validator BasicAuthValidator, realm string) *BasicAuth

NewBasicAuthRealm returns an instance of BasicAuth authticator.

func (*BasicAuth) Authenticate

func (a *BasicAuth) Authenticate(r *http.Request, w http.ResponseWriter) (auth.Identity, error)

Authenticate implements Authenticator.Authenticate.

func (*BasicAuth) Challenge

func (a *BasicAuth) Challenge(r *http.Request, w http.ResponseWriter)

Challenge implements Authenticator.Challenge.

func (BasicAuth) GetIdentityByToken added in v0.3.0

func (a BasicAuth) GetIdentityByToken(token string) (auth.Identity, error)

func (BasicAuth) SetTokenType added in v0.3.0

func (a BasicAuth) SetTokenType(v string)

type BasicAuthValidator added in v0.3.0

type BasicAuthValidator func(username, password string) bool

BasicAuthValidator is a function that validates the given username and password is valid or not.

type BearerToken

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

BearerToken is an authenticator that retrieves bearer token from authorization header and authenticates an user.

func NewBearerToken

func NewBearerToken(store auth.IdentityStore) *BearerToken

NewBearerToken returns an instance of BearerToken authticator with the given store and default realm.

func NewBearerTokenRealm added in v0.3.0

func NewBearerTokenRealm(store auth.IdentityStore, realm string) *BearerToken

NewBearerTokenRealm returns an instance of BearerToken authticator with the given store and realm.

func (*BearerToken) Authenticate

func (a *BearerToken) Authenticate(r *http.Request, w http.ResponseWriter) (auth.Identity, error)

Authenticate implements Authenticator.Authenticate.

func (*BearerToken) Challenge

func (a *BearerToken) Challenge(r *http.Request, w http.ResponseWriter)

Challenge implements Authenticator.Challenge.

func (BearerToken) GetIdentityByToken added in v0.3.0

func (a BearerToken) GetIdentityByToken(token string) (auth.Identity, error)

func (BearerToken) SetTokenType added in v0.3.0

func (a BearerToken) SetTokenType(v string)

type Composite

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

Composite is a set of authenticators.

func NewComposite

func NewComposite(authenticators ...auth.Authenticator) *Composite

NewComposite returns an instance of composite authenticator.

func (*Composite) Authenticate

func (a *Composite) Authenticate(r *http.Request, w http.ResponseWriter) (auth.Identity, error)

Authenticate implements Authenticator.Authenticate.

func (*Composite) Challenge

func (a *Composite) Challenge(r *http.Request, w http.ResponseWriter)

Challenge implements Challenge.Authenticate.

type CompositeError added in v0.3.0

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

CompositeError contains errors that returned by authenticators.

func (CompositeError) Error added in v0.3.0

func (e CompositeError) Error() (s string)

Error returns error message.

type CookieToken

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

CookieToken is an authenticator that retrieves token from cookie and authenticates an user.

func NewCookieToken

func NewCookieToken(store auth.IdentityStore) *CookieToken

NewCookieToken returns an instance of CookieToken authenticator with the given store and default token param.

func NewCookieTokenParam added in v0.3.0

func NewCookieTokenParam(store auth.IdentityStore, param string) *CookieToken

NewCookieTokenParam returns an instance of CookieToken authenticator with the given store and param.

func (*CookieToken) Authenticate

func (a *CookieToken) Authenticate(r *http.Request, w http.ResponseWriter) (auth.Identity, error)

Authenticate implements Authenticator.Authenticate.

func (*CookieToken) Challenge

func (a *CookieToken) Challenge(r *http.Request, w http.ResponseWriter)

Challenge implements Authenticator.Challenge.

func (CookieToken) GetIdentityByToken added in v0.3.0

func (a CookieToken) GetIdentityByToken(token string) (auth.Identity, error)

func (CookieToken) SetTokenType added in v0.3.0

func (a CookieToken) SetTokenType(v string)

type QueryToken

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

QueryToken is an authenticator that retrieves token from URL query and authenticates an user.

func NewQueryToken

func NewQueryToken(store auth.IdentityStore) *QueryToken

NewQueryToken returns an instance of QueryToken authenticator with the given identity store and default token param.

func NewQueryTokenParam added in v0.3.0

func NewQueryTokenParam(store auth.IdentityStore, param string) *QueryToken

NewQueryTokenParam returns an instance of QueryToken authenticator with the given identity store and param.

func (*QueryToken) Authenticate

func (a *QueryToken) Authenticate(r *http.Request, w http.ResponseWriter) (auth.Identity, error)

Authenticate implements Authenticator.Authenticate.

func (*QueryToken) Challenge

func (a *QueryToken) Challenge(r *http.Request, w http.ResponseWriter)

Challenge implements Authenticator.Challenge.

func (QueryToken) GetIdentityByToken added in v0.3.0

func (a QueryToken) GetIdentityByToken(token string) (auth.Identity, error)

func (QueryToken) SetTokenType added in v0.3.0

func (a QueryToken) SetTokenType(v string)

Jump to

Keyboard shortcuts

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