Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultJWTConfig is the default JWT auth middleware config. DefaultFirebaseJWTConfig = JWTConfig{ Skipper: middleware.DefaultSkipper, ContextSpecifier: func(token *auth.Token) (string, interface{}) { return "user", token }, TokenLookup: "header:" + echo.HeaderAuthorization, AuthScheme: "Bearer", } )
View Source
var (
ErrJWTMissing = echo.NewHTTPError(http.StatusBadRequest, "missing or malformed jwt")
)
Errors
Functions ¶
Types ¶
type JWTConfig ¶
type JWTConfig struct { // Firebase app. // Required. App *firebase.App // Skipper defines a function to skip middleware. Skipper middleware.Skipper // BeforeFunc defines a function which is executed just before the middleware. BeforeFunc middleware.BeforeFunc // SuccessHandler defines a function which is executed for a valid token. SuccessHandler JWTSuccessHandler // ErrorHandler defines a function which is executed for an invalid token. // It may be used to define a custom JWT error. ErrorHandler JWTErrorHandler // JWTContextSpecifier defines a function which returns (context-key, token-value). // The token-value will be stored into context with context-key. // Optional. Default values are ("user", *auth.Token) ContextSpecifier JWTContextSpecifier // TokenLookup is a string in the form of "<source>:<name>" that is used // to extract token from the request. // Optional. Default value "header:Authorization". // Possible values: // - "header:<name>" // - "query:<name>" // - "cookie:<name>" TokenLookup string // AuthScheme to be used in the Authorization header. // Optional. Default value "Bearer". AuthScheme string }
JWTConfig defines the config for JWT middleware.
type JWTContextSpecifier ¶
JWTContextSpecifier defines a function which returns (context-key, token-value). The token-value will be stored into context with context-key. Optional. Default values are ("user", *auth.Token)
type JWTErrorHandler ¶
JWTErrorHandler defines a function which is executed for an invalid token.
type JWTSuccessHandler ¶
type JWTSuccessHandler func(echo.Context)
JWTSuccessHandler defines a function which is executed for a valid token.
Click to show internal directories.
Click to hide internal directories.