Documentation
¶
Index ¶
Constants ¶
View Source
const ( AuthKindJWT = "jwt" AuthKindBasic = "basic" AuthKindSimpleJWT = "simple-jwt" AuthKindApiKey = "apiKey" )
Variables ¶
View Source
var ( // ErrNoAuthData that is returned if the authorizer doesn't find any data in the request that can be used for auth. ErrNoAuthData = errors.New("the request doesn't contain any auth data that can be used by the Authorizer") )
View Source
var WireSet = wire.NewSet( ProvideAuthenticators, )
WireSet provides a wire set for this package.
Functions ¶
func ExtractToken ¶
func Register ¶
func Register(kind authKind, authenticator Authenticator) error
Types ¶
type Authenticator ¶
type Authenticator interface {
/*
* Tries to authenticate the acting principal if credentials are available.
* Returns:
* (session, nil) - request contains auth data and principal was verified
* (nil, ErrNoAuthData) - request doesn't contain any auth data
* (nil, err) - request contains auth data but verification failed
*/
Authenticate(r *http.Request) (*auth.Session, error)
}
Authenticator is an abstraction of an entity that's responsible for authenticating principals that are making calls via HTTP.
func Get ¶
func Get(kind authKind) Authenticator
func ProvideAuthenticator ¶
func ProvideAuthenticator( config *types.Config, principalStore store.PrincipalStore, tokenStore store.TokenStore, ) Authenticator
func ProvideAuthenticators ¶
func ProvideAuthenticators( config *types.Config, principalStore store.PrincipalStore, tokenStore store.TokenStore, ) Authenticator
type BasicAuthenticator ¶
type BasicAuthenticator struct {
// contains filtered or unexported fields
}
BasicAuthenticator uses the provided JWT to authenticate the caller.
func NewBasicAuthenticator ¶
func NewBasicAuthenticator( principalStore store.PrincipalStore, tokenStore store.TokenStore, ) *BasicAuthenticator
func (*BasicAuthenticator) Authenticate ¶
type JWTAuthenticator ¶
type JWTAuthenticator struct {
// contains filtered or unexported fields
}
JWTAuthenticator uses the provided JWT to authenticate the caller.
func NewTokenAuthenticator ¶
func NewTokenAuthenticator( principalStore store.PrincipalStore, tokenStore store.TokenStore, cookieName string, ) *JWTAuthenticator
func (*JWTAuthenticator) Authenticate ¶
type SimpleJWTAuthenticator ¶
type SimpleJWTAuthenticator struct {
// contains filtered or unexported fields
}
SimpleJWTAuthenticator uses the provided JWT to authenticate the caller.
func NewSimpleTokenAuthenticator ¶
func NewSimpleTokenAuthenticator( principalStore store.PrincipalStore, cookieName string, ) *SimpleJWTAuthenticator
func (*SimpleJWTAuthenticator) Authenticate ¶
Click to show internal directories.
Click to hide internal directories.