authenticators

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoCredentials = errors.New("no credentials provided")
)

Errors

Functions

This section is empty.

Types

type BasicAuth

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

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

func NewBasicAuth

func NewBasicAuth(realm string, validate func(username, password string) bool, store auth.IdentityStore) *BasicAuth

NewBasicAuth returns an instance of BasicAuth authticator.

func (*BasicAuth) Authenticate

func (ba *BasicAuth) Authenticate(r *http.Request) (auth.Identity, error)

Authenticate implements Authenticator.Authenticate.

func (*BasicAuth) Challenge

func (ba *BasicAuth) Challenge(w http.ResponseWriter)

Challenge implements Authenticator.Challenge.

type BearerToken

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

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

func NewBearerToken

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

NewBearerToken returns an instance of BearerToken authticator.

func (*BearerToken) Authenticate

func (bt *BearerToken) Authenticate(r *http.Request) (auth.Identity, error)

Authenticate implements Authenticator.Authenticate.

func (*BearerToken) Challenge

func (bt *BearerToken) Challenge(w http.ResponseWriter)

Challenge implements Authenticator.Challenge.

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 (c *Composite) Authenticate(r *http.Request) (auth.Identity, error)

Authenticate implements Authenticator.Authenticate.

func (*Composite) Challenge

func (c *Composite) Challenge(w http.ResponseWriter)

Challenge implements Challenge.Authenticate.

type CookieToken

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

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

func NewCookieToken

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

NewCookieToken returns an instance of CookieToken authenticator.

func (*CookieToken) Authenticate

func (ct *CookieToken) Authenticate(r *http.Request) (auth.Identity, error)

Authenticate implements Authenticator.Authenticate.

func (*CookieToken) Challenge

func (ct *CookieToken) Challenge(http.ResponseWriter)

Challenge implements Authenticator.Challenge.

type QueryToken

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

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

func NewQueryToken

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

NewQueryToken returns a instance of QueryToken authenticator.

func (*QueryToken) Authenticate

func (qt *QueryToken) Authenticate(r *http.Request) (auth.Identity, error)

Authenticate implements Authenticator.Authenticate.

func (*QueryToken) Challenge

func (qt *QueryToken) Challenge(w http.ResponseWriter)

Challenge implements Authenticator.Challenge.

Jump to

Keyboard shortcuts

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