Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrReadingAuthCookie = fmt.Errorf("failed to read auth cookie") ErrInvalidAuthCookie = fmt.Errorf("invalid auth cookie") ErrInvalidAccessToken = fmt.Errorf("invalid access token") )
ErrReadingAuthCookie occurs when tavern is unable to read the auth cookie of the request. ErrInvalidAuthCookie occurs when the auth cookie provided by the request is invalid. ErrInvalidAccessToken occurs when the access token provided by the request is invalid.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
An Authenticator returns an authenticated context based on the given http request. If no authenticated identity is associated with the request, the authenticator should just return the request context, and it should not error in this case. This is to allow unauthenticated endpoints to function as expected, authorization will occur later in the stack.
type Endpoint ¶
type Endpoint struct { // LoginRedirectURI defines the path to redirect unauthenticated requests to. // If unset, no redirect will be performed. LoginRedirectURI string http.Handler }
An Endpoint wraps an HTTP handler with configuration options.
type Option ¶
type Option func(*Server)
An Option to configure a Tavern HTTP Server.
func WithAuthentication ¶ added in v0.0.6
WithAuthentication enables http request authentication for the server.
func WithAuthenticationBypass ¶
WithAuthenticationBypass enables requests to bypass authentication for the server.
func WithRequestLogging ¶
WithRequestLogging configures HTTP request logging for the server.
type RouteMap ¶
A RouteMap contains a mapping of route patterns to http handlers.
func (RouteMap) Handle ¶
Handle registers the handler for the given pattern. If a handler already exists for pattern, Handle panics.
func (RouteMap) HandleFunc ¶
HandleFunc registers the handler function for the given pattern.