Documentation ¶
Index ¶
- Constants
- Variables
- type Claims
- func (c Claims) GetAudience() (jwt.ClaimStrings, error)
- func (c Claims) GetClientID() (string, error)
- func (c Claims) GetDeviceID(deviceIDClaim string) (string, error)
- func (c Claims) GetEmail() (string, error)
- func (c Claims) GetExpirationTime() (*jwt.NumericDate, error)
- func (c Claims) GetID() (string, error)
- func (c Claims) GetIssuedAt() (*jwt.NumericDate, error)
- func (c Claims) GetIssuer() (string, error)
- func (c Claims) GetName() (string, error)
- func (c Claims) GetNotBefore() (*jwt.NumericDate, error)
- func (c Claims) GetOwner(ownerClaim string) (string, error)
- func (c Claims) GetScope() (jwt.ClaimStrings, error)
- func (c Claims) GetSubject() (string, error)
- func (c Claims) ValidateOwnerClaim(ownerClaim string, userID string) error
- type KeyCache
- func (c *KeyCache) FetchKeys() error
- func (c *KeyCache) FetchKeysWithContext(ctx context.Context) error
- func (c *KeyCache) GetKey(token *jwt.Token) (interface{}, error)
- func (c *KeyCache) GetOrFetchKey(token *jwt.Token) (interface{}, error)
- func (c *KeyCache) GetOrFetchKeyWithContext(ctx context.Context, token *jwt.Token) (interface{}, error)
- func (c *KeyCache) LookupKey(token *jwt.Token) (jwk.Key, error)
- type ScopeClaims
- func (c *ScopeClaims) GetAudience() (jwt.ClaimStrings, error)
- func (c *ScopeClaims) GetExpirationTime() (*jwt.NumericDate, error)
- func (c *ScopeClaims) GetIssuedAt() (*jwt.NumericDate, error)
- func (c *ScopeClaims) GetIssuer() (string, error)
- func (c *ScopeClaims) GetNotBefore() (*jwt.NumericDate, error)
- func (c *ScopeClaims) GetSubject() (string, error)
- func (c *ScopeClaims) Validate() error
- type Validator
Constants ¶
const ( ClaimExpirationTime = "exp" ClaimNotBefore = "nbf" ClaimIssuedAt = "iat" ClaimAudience = "aud" ClaimIssuer = "iss" ClaimSubject = "sub" ClaimScope = "scope" ClaimID = "jti" ClaimEmail = "email" ClaimClientID = "client_id" ClaimName = "n" )
const PlgdRequiredScope = "plgd:required:scope"
Variables ¶
var ( ErrMissingToken = errors.New("missing token") ErrCannotParseToken = errors.New("could not parse token") )
var ErrMissingRequiredScopes = errors.New("required scopes not found")
var ErrOwnerClaimInvalid = errors.New("owner claim is invalid")
Functions ¶
This section is empty.
Types ¶
type Claims ¶
type Claims jwt.MapClaims
func ParseToken ¶
func (Claims) GetAudience ¶ added in v2.16.3
GetAudience returns the Audience ("aud") claim. If the claim does not exist, nil is returned. If the claim has the wrong type, an error is returned.
func (Claims) GetClientID ¶ added in v2.16.3
GetClientID returns the ClientID ("client_id") claim. If the claim does not exist, an empty string is returned. If the claim has the wrong type, an error is returned.
func (Claims) GetDeviceID ¶ added in v2.16.3
GetDeviceID returns the DeviceID ("device_id") claim. If the claim does not exist, an empty string is returned. If the claim has the wrong type, an error is returned.
func (Claims) GetEmail ¶ added in v2.16.3
GetEmail returns the Email ("email") claim. If the claim does not exist, an empty string is returned. If the claim has the wrong type, an error is returned.
func (Claims) GetExpirationTime ¶ added in v2.16.3
GetExpirationTime returns the Expiration Time ("exp") claim. If the claim does not exist, nil is returned. If the claim has the wrong type, an error is returned.
func (Claims) GetID ¶ added in v2.16.3
GetID returns the ID ("jti") claim. If the claim does not exist, an empty string is returned. If the claim has the wrong type, an error is returned.
func (Claims) GetIssuedAt ¶ added in v2.16.3
GetIssuedAt returns the Issued At ("iat") claim. If the claim does not exist, nil is returned. If the claim has the wrong type, an error is returned.
func (Claims) GetIssuer ¶ added in v2.16.3
GetIssuer returns the Issuer ("iss") claim. If the claim does not exist, nil is returned. If the claim has the wrong type, an error is returned.
func (Claims) GetName ¶ added in v2.16.3
GetName returns the Name ("n") claim. If the claim does not exist, an empty string is returned. If the claim has the wrong type, an error is returned.
func (Claims) GetNotBefore ¶ added in v2.16.3
GetNotBefore returns the Not Before ("nbf") claim. If the claim does not exist, nil is returned. If the claim has the wrong type, an error is returned.
func (Claims) GetOwner ¶ added in v2.16.3
GetOwner returns the Owner ("owner") claim. If the claim does not exist, an empty string is returned. If the claim has the wrong type, an error is returned.
func (Claims) GetScope ¶ added in v2.16.3
GetScope returns the Scope ("scope") claim. If the claim does not exist, nil is returned. If the claim has the wrong type, an error is returned.
func (Claims) GetSubject ¶ added in v2.16.3
GetSubject returns the Subject ("sub") claim. If the claim does not exist, nil is returned. If the claim has the wrong type, an error is returned.
type KeyCache ¶
type KeyCache struct {
// contains filtered or unexported fields
}
func (*KeyCache) FetchKeysWithContext ¶
func (*KeyCache) GetOrFetchKey ¶
func (*KeyCache) GetOrFetchKeyWithContext ¶
type ScopeClaims ¶
type ScopeClaims Claims
func NewRegexpScopeClaims ¶
func NewRegexpScopeClaims(scope ...*regexp.Regexp) *ScopeClaims
func NewScopeClaims ¶
func NewScopeClaims(scope ...string) *ScopeClaims
func (*ScopeClaims) GetAudience ¶ added in v2.16.3
func (c *ScopeClaims) GetAudience() (jwt.ClaimStrings, error)
func (*ScopeClaims) GetExpirationTime ¶ added in v2.16.3
func (c *ScopeClaims) GetExpirationTime() (*jwt.NumericDate, error)
func (*ScopeClaims) GetIssuedAt ¶ added in v2.16.3
func (c *ScopeClaims) GetIssuedAt() (*jwt.NumericDate, error)
func (*ScopeClaims) GetIssuer ¶ added in v2.16.3
func (c *ScopeClaims) GetIssuer() (string, error)
func (*ScopeClaims) GetNotBefore ¶ added in v2.16.3
func (c *ScopeClaims) GetNotBefore() (*jwt.NumericDate, error)
func (*ScopeClaims) GetSubject ¶ added in v2.16.3
func (c *ScopeClaims) GetSubject() (string, error)
func (*ScopeClaims) Validate ¶ added in v2.16.3
func (c *ScopeClaims) Validate() error
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}