authenticators

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: BSD-3-Clause Imports: 5 Imported by: 2

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

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

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

func (BasicAuth) SetTokenType

func (a BasicAuth) SetTokenType(v string)

type BasicAuthValidator

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

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

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

func (BearerToken) SetTokenType

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

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

CompositeError contains errors that returned by authenticators.

func (CompositeError) Error

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

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

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

func (CookieToken) SetTokenType

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

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

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

func (QueryToken) SetTokenType

func (a QueryToken) SetTokenType(v string)

Jump to

Keyboard shortcuts

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