Documentation
¶
Overview ¶
Package jwtclaims provide the Claims type providing helper functions to work with JWT claims
Index ¶
- Constants
- type Claims
- func (c Claims) AuthTime() time.Time
- func (c Claims) ClientID() string
- func (c Claims) EventID() string
- func (c Claims) Exp() time.Time
- func (c Claims) Iat() time.Time
- func (c Claims) Iss() string
- func (c Claims) Jti() string
- func (c Claims) Nbf() time.Time
- func (c Claims) OriginJti() string
- func (c Claims) Scope() string
- func (c Claims) Sub() string
- func (c Claims) Timestamp(claim string) time.Time
- func (c Claims) TokenUse() string
- func (c Claims) Username() string
Constants ¶
const ( Iss = "iss" // Issuer claim - identifies the principal that issued the JWT Jti = "jti" // JWT ID claim - unique identifier for the JWT Scope = "scope" // Scope claim - space-separated list of scopes Sub = "sub" // Subject claim - identifies the principal that is the subject of the JWT Exp = "exp" // Expiration time claim - expiration time on or after which the JWT must not be accepted Iat = "iat" // Issued at claim - time at which the JWT was issued Nbf = "nbf" // Not before claim - time before which the JWT must not be accepted Username = "username" // Username claim - AWS-specific claim for the username ClientID = "client_id" // Client ID claim - OAuth2/AWS client identifier OriginJti = "origin_jti" // Original JWT ID claim - AWS-specific claim for token refresh EventID = "event_id" // Event ID claim - AWS-specific claim for event identification TokenUse = "token_use" // Token use claim - AWS-specific claim indicating token usage (id/access) AuthTime = "auth_time" // Authentication time claim - time when authentication occurred )
Standard JWT claim names and AWS-specific extensions
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claims ¶
Claims is a map of JWT claim names and values
func (Claims) AuthTime ¶
AuthTime returns the value of the auth_time claim, converted to a time.Time. If auth_time is either undefined or not a valid timestamp, the zero value of time.Time is returned
func (Claims) Exp ¶
Exp returns the value of the exp claim, converted to a time.Time. If exp is either undefined or not a valid timestamp, the zero value of time.Time is returned
func (Claims) Iat ¶
Iat returns the value of the iat claim, converted to a time.Time. If iat is either undefined or not a valid timestamp, the zero value of time.Time is returned
func (Claims) Nbf ¶
Nbf returns the value of the nbf claim, converted to a time.Time. If nbf is either undefined or not a valid timestamp, the zero value of time.Time is returned
func (Claims) Timestamp ¶
Timestamp returns the value of the given claim converted to a time.Time. If the value of the claim is either undefined or not a valid timestamp, the zero value of time.Time is returned