Documentation ¶
Index ¶
- type BasicAuth
- func (a *BasicAuth) Authenticate(r *http.Request, w http.ResponseWriter) (auth.Identity, error)
- func (a *BasicAuth) Challenge(r *http.Request, w http.ResponseWriter)
- func (a BasicAuth) GetIdentityByToken(ctx context.Context, token string) (auth.Identity, error)
- func (a BasicAuth) SetTokenType(v string)
- type BasicAuthValidator
- type BearerToken
- func (a *BearerToken) Authenticate(r *http.Request, w http.ResponseWriter) (auth.Identity, error)
- func (a *BearerToken) Challenge(r *http.Request, w http.ResponseWriter)
- func (a BearerToken) GetIdentityByToken(ctx context.Context, token string) (auth.Identity, error)
- func (a BearerToken) SetTokenType(v string)
- type Composite
- type CompositeError
- type CookieToken
- func (a *CookieToken) Authenticate(r *http.Request, w http.ResponseWriter) (auth.Identity, error)
- func (a *CookieToken) Challenge(r *http.Request, w http.ResponseWriter)
- func (a CookieToken) GetIdentityByToken(ctx context.Context, token string) (auth.Identity, error)
- func (a CookieToken) SetTokenType(v string)
- type QueryToken
- func (a *QueryToken) Authenticate(r *http.Request, w http.ResponseWriter) (auth.Identity, error)
- func (a *QueryToken) Challenge(r *http.Request, w http.ResponseWriter)
- func (a QueryToken) GetIdentityByToken(ctx context.Context, token string) (auth.Identity, error)
- func (a QueryToken) SetTokenType(v string)
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 ¶
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 (BasicAuth) SetTokenType ¶
func (a BasicAuth) SetTokenType(v string)
type BasicAuthValidator ¶
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 (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 ¶
Authenticate implements Authenticator.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 (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 (QueryToken) SetTokenType ¶
func (a QueryToken) SetTokenType(v string)