Documentation ¶
Index ¶
Constants ¶
View Source
const ( //ErrorTokenIsEmpty means that middleware could not find Bearer JWT token in headers ErrorTokenIsEmpty = "middleware.token_is_empty" //ErrorTokenIsInvalid token validation failed ErrorTokenIsInvalid = "middleware.token_is_invalid" )
View Source
const ( // AuthorizationHeaderKey is a header name for Bearer token. AuthorizationHeaderKey = "Authorization" // TokenTypeAccess is an access token type. TokenTypeAccess = "access" // TokenTypeRefresh is a refresh token type. TokenTypeRefresh = "refresh" // AccessTokenContextKey context key to store and retreive access token AccessTokenContextKey = "identifo.token.access" // RefreshTokenContextKey context key to store and retreive refresh token RefreshTokenContextKey = "identifo.token.refresh" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Error ¶
type Error string
Error represents error for middleware
func (Error) Description ¶
Description returns description for error
type ErrorHandler ¶
type ErrorHandler interface {
Error(rw http.ResponseWriter, errorType Error, status int, description string)
}
ErrorHandler interface for handling error from middleware rw - readwriter to write error to (JSON, HTML or other error to the client) errorType - error returned from middleware, you can get description by calling errorType.Description() status - http status code
type Handler ¶
type Handler func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
Handler is a full copy of negroni.HandlerFunc this is the same http.HandlerFunc, it just has one additional parameter 'next' next is a reference to the next handler in the handler chain
Click to show internal directories.
Click to hide internal directories.