Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NewRequestAuthenticator ¶
func NewRequestAuthenticator(context RequestContext, auth authenticator.Request, failed http.Handler, handler http.Handler) http.Handler
NewRequestAuthenticator creates an http handler that tries to authenticate the given request as a user, and then stores any such user found onto the provided context for the request. If authentication fails or returns an error the failed handler is used. On success, handler is invoked to serve the request.
Types ¶
type RequestContext ¶
RequestContext is the interface used to associate a user with an http Request.
type UserRequestContext ¶
type UserRequestContext struct {
// contains filtered or unexported fields
}
UserRequestContext allows different levels of a call stack to store/retrieve info about the current user associated with an http.Request.
func NewUserRequestContext ¶
func NewUserRequestContext() *UserRequestContext
NewUserRequestContext provides a map for storing and retrieving users associated with requests. Be sure to pair each `context.Set(req, user)` call with a `defer context.Remove(req)` call or you will leak requests. It implements the RequestContext interface.
func (*UserRequestContext) Remove ¶
func (c *UserRequestContext) Remove(req *http.Request)