Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithToken ¶
ContextWithToken creates a new Context with the token
func GetAuthHeader ¶
GetAuthHeader creates the valid value for the authentication header
func GetBearerTokenFromHeader ¶
GetBearerTokenFromHeader removes the prefix of authHeader authHeader should be the value of the authorization header field. success: returns the bearer token without the prefix error: return an empty token
Types ¶
type Authorizer ¶
type Authorizer interface { // Authorize should authorize a request. // Success: returns a context with information of the authorization // Error: Handles Errors (logging and creating a response with the error), // returns the unchanged context of the request and false Authorize(r *http.Request, w http.ResponseWriter) (context.Context, bool) }
Authorizer describes the needed functions for authorization, already implemented in oauth2.Authorizer and apikey.Authorizer
type CanAuthorize ¶ added in v0.1.27
type CanAuthorize interface { // CanAuthorizeRequest should check if a request contains the needed information to be authorized CanAuthorizeRequest(r http.Request) bool }
CanAuthorize offers a method to check if an authorizer can authorize a request
Click to show internal directories.
Click to hide internal directories.