Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidContentType = errors.New("Should have a JSON content type for JWKS endpoint.") ErrNoKeyFound = errors.New("No Keys has been found") ErrInvalidTokenHeader = errors.New("No valid header found") ErrInvalidAlgorithm = errors.New("Only RS256 is supported") )
var (
ErrNoJWTHeaders = errors.New("No headers in the token")
)
var (
ErrTokenNotFound = errors.New("Token not found")
)
Functions ¶
func FromHeader ¶
func FromHeader(r *http.Request) (*jwt.JSONWebToken, error)
FromHeader looks for the request in the authentication header or call ParseMultipartForm if not present.
Types ¶
type Configuration ¶
type Configuration struct {
// contains filtered or unexported fields
}
Configuration contains all the information about the Auth0 service.
func NewConfiguration ¶
func NewConfiguration(provider SecretProvider, audience []string, issuer string, method jose.SignatureAlgorithm) Configuration
NewConfiguration creates a configuration for server
type JWKClient ¶
type JWKClient struct {
// contains filtered or unexported fields
}
func NewJWKClient ¶
func NewJWKClient(options JWKClientOptions) *JWKClient
NewJWKClient creates a new JWKClient instance from the provided options.
type JWKClientOptions ¶
type JWKClientOptions struct {
URI string
}
type JWTValidator ¶
type JWTValidator struct {
// contains filtered or unexported fields
}
JWTValidator helps middleware to validate token
func NewValidator ¶
func NewValidator(config Configuration) *JWTValidator
NewValidator creates a new validator with the provided configuration.
func (*JWTValidator) Claims ¶
func (v *JWTValidator) Claims(req *http.Request, token *jwt.JSONWebToken, values ...interface{}) error
Claims unmarshall the claims of the provided token
func (*JWTValidator) ValidateRequest ¶
func (v *JWTValidator) ValidateRequest(r *http.Request) (*jwt.JSONWebToken, error)
ValidateRequest validates the token within the http request.
type RequestTokenExtractor ¶
type RequestTokenExtractor interface {
Extract(r *http.Request) (*jwt.JSONWebToken, error)
}
RequestTokenExtractor can extract a JWT from a request.
type RequestTokenExtractorFunc ¶
type RequestTokenExtractorFunc func(r *http.Request) (*jwt.JSONWebToken, error)
RequestTokenExtractorFunc function conforming to the RequestTokenExtractor interface.
func (RequestTokenExtractorFunc) Extract ¶
func (f RequestTokenExtractorFunc) Extract(r *http.Request) (*jwt.JSONWebToken, error)
Extract calls f(r)
type SecretProvider ¶
SecretProvider will provide everything needed retrieve the secret.
func NewKeyProvider ¶
func NewKeyProvider(key interface{}) SecretProvider
NewKeyProvider provide a simple passphrase key provider.
type SecretProviderFunc ¶
SecretProviderFunc simple wrappers to provide secret with functions.