Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type JwtConfig ¶
type JwtConfig struct {
Jwt *JwtOptions `mapstructure:"jwt" json:"jwt" yaml:"jwt"`
}
type JwtHandler ¶
type JwtHandler struct {
// contains filtered or unexported fields
}
func (JwtHandler) ServeHTTP ¶
func (h JwtHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
type JwtOptions ¶
type JwtOptions struct { // enable jwt middleware Enabled bool `mapstructure:"enabled" json:"enabled" yaml:"enabled"` // Algorithm to use to validate the token // This is mandatory due to a security issue (see: https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries) Alg string `mapstructure:"alg" json:"alg" yaml:"alg"` // Secret or private key to verify the jwt // This is required Secret string `mapstructure:"secret" json:"secret" yaml:"secret"` // When set, all requests with the OPTIONS method will use authentication // Default: false EnableAuthOnOptions bool `mapstructure:"enable_auth_on_options" json:"enable_auth_on_options" yaml:"enable_auth_on_options"` // If not empty, it will validate that the jwt contains this audience Audience string `mapstructure:"audience" json:"audience" yaml:"audience"` // If not empty, it will validate that the jwt contains this issuer Issuer string `mapstructure:"issuer" json:"issuer" yaml:"issuer"` // Add custom check to verify that the jwt contains those specified claims with specified value CustomVerify map[string]string `mapstructure:"custom_verify" json:"custom_verify" yaml:"custom_verify"` // Set to true to not verify issued at of token (Useful when you have different time between user and server) NotVerifyIssuedAt bool `mapstructure:"not_verify_expire" json:"not_verify_expire" yaml:"not_verify_expire"` // Passthrough if a previous middleware already set user context // This is helpful when you want add user with basic auth middleware TrustCurrentUser bool `mapstructure:"trust_current_user" json:"trust_current_user" yaml:"trust_current_user"` }
Click to show internal directories.
Click to hide internal directories.