Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Name token name, default: Authorization Name string // Signing key to validate token SigningKey string // ErrorHandler validate error handler, default: defaultOnError ErrorHandler errorHandler // Extractor extract jwt token, default extract from header: defaultExtractorFromHeader Extractor tokenExtractor // EnableAuthOnOptions http option method validate switch EnableAuthOnOptions bool // SigningMethod sign method, default: HS256 SigningMethod gojwt.SigningMethod // ExcludeURL exclude url will skip jwt validator ExcludeURL []string // ExcludePrefix exclude url prefix will skip jwt validator ExcludePrefix []string // ContextKey Context key to store user information from the token into context. // Optional. Default value "". ContextKey string // HeaderKey Header key to store user information from the token into Header. // Optional. Default value "". HeaderKey string // CustomValidator custom validator suggestion flow: // 1. check exlude url, and exclude url prefix // 2. extract token string // 3. check token sign // 4. check token ttl // 5. save custom value to conext after check passed // 6. handle addon validator CustomValidator customValidator // contains filtered or unexported fields }
Config JWT Middleware config
type Provider ¶
type Provider struct {
Config *Config
}
Provider JWT validator handler
func (*Provider) Auth ¶
func (t *Provider) Auth(req *restful.Request, resp *restful.Response, chain *restful.FilterChain)
func (*Provider) GeneratorToken ¶
GeneratorToken generate token by custom value and token ttl
func (*Provider) GetCustomValue ¶
GetCustomValue return custom value in token, or returns error
Click to show internal directories.
Click to hide internal directories.