Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTokenExpired = errors.New("auth: session expired") ErrNoAuthToken = errors.New("auth: either specify '" + loginCookieName + "' cookie or 'Authorization' header") )
Functions ¶
func DeleteLoginCookie ¶
Types ¶
type HttpRequestAuthenticator ¶
type HttpRequestAuthenticator interface { // authenticates a Request. error is ErrNoAuthToken if no auth details and ErrSessionExpired if auth token expired Authenticate(req *http.Request) (*UserDetails, error) AuthenticateJwtString(jwtString string) (*UserDetails, error) }
func NewJwtAuthenticator ¶
func NewJwtAuthenticator(publicKey ed25519.PublicKey, audience string) (HttpRequestAuthenticator, error)
type MiddlewareChain ¶
type MiddlewareChain func(w http.ResponseWriter, r *http.Request) *RequestContext
if returns nul, request handling is aborted. in return=nil case middleware is responsible for error response.
type MiddlewareChainMap ¶
type MiddlewareChainMap map[string]MiddlewareChain
type RequestContext ¶
type RequestContext struct {
User *UserDetails
}
type Signer ¶
type Signer interface {
Sign(userDetails UserDetails, audience string, now time.Time) string
}
func NewJwtSigner ¶
func NewJwtSigner(privKey ed25519.PrivateKey) (Signer, error)
type UserDetails ¶
func NewUserDetails ¶
func NewUserDetails(id string, authTokenJwt string) *UserDetails
Click to show internal directories.
Click to hide internal directories.