Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAuthMissing = errors.New("missing authorization header") ErrAuthMultiple = errors.New("multiple authorization headers") ErrAuthMalformed = errors.New("malformed authorization header") ErrTokenMalformed = jwt.ErrTokenMalformed ErrTokenMalformedHeader = errors.New("jwt header is malformed") ErrTokenUnknownKeyID = errors.New("jwt header contains unknown key id") ErrTokenMalformedPayload = jwt.ErrTokenMalformedPayload ErrTokenInvalidIssuerAudience = errors.New("jwt payload contains invalid issuer audience pair") ErrTokenInvalidSignature = jwt.ErrTokenInvalidSignature )
Functions ¶
Types ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group represents a group of identity providers from which an application will accept authorization tokens (JWTs).
func (Group) Deregister ¶
Deregister deregisters a provider p from group g.
func (Group) Middleware ¶
Middleware returns group g's middleware.
The returned middleware will fail any request without a valid bearer token (from any of the registered providers for g) in the Authorization header.
type Provider ¶
type Provider interface {
// Issuer returns the identity provider's issuer for this application.
Issuer() string
// Audience returns the identity provider's audience for this application.
Audience() string
// Status indicates the identity provider's availability.
Status() ProviderStatus
// GetKeyByID returns the identity provider's public key associated with id.
GetKeyByID(id string) (jwk.PublicKey, bool)
// Claims returns the claims in the token's body. An error should be
// returned if the token's body is not a valid json struct. Note that the
// validity of the signature should be checked separately.
Claims(token *jwt.Token) (map[string]any, error)
}
Provider represents an identity provider for an application.
type ProviderStatus ¶
type ProviderStatus int
ProviderStatus represents the status of an identity provider.
const ( StatusUp ProviderStatus = iota StatusDown )
Source Files
¶
- auth.go
- context.go
- group.go
- provider.go
Click to show internal directories.
Click to hide internal directories.