Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractCustomClaims ¶
ExtractCustomClaims extracts the custom claim from an access token.
Types ¶
type TAccessToken ¶
type TAccessToken struct {
// Token is the compact JWT string.
Token string
// Expiration is the lifetime used when the token was issued.
Expiration time.Duration
// ExpiresAt is the instant after which the token is expired.
ExpiresAt time.Time
}
TAccessToken is a signed JWT together with its lifetime.
func NewAccessToken ¶
func NewAccessToken(user string, expiration *time.Duration, customClaims string) (TAccessToken, error)
NewAccessToken creates a signed JWT access token.
type TRefreshToken ¶
type TRefreshToken struct {
// Token is the opaque refresh-token string.
Token string
// Expiration is the lifetime used when the token was issued.
Expiration time.Duration
// ExpiresAt is the instant after which the token is expired.
ExpiresAt time.Time
}
TRefreshToken is an opaque refresh token together with its lifetime.
func NewRefreshToken ¶
func NewRefreshToken(expiration *time.Duration) (TRefreshToken, error)
NewRefreshToken creates a random refresh token.
type TTokens ¶
type TTokens struct {
AccessToken TAccessToken `json:"access_token"`
RefreshToken TRefreshToken `json:"refresh_token"`
}
Click to show internal directories.
Click to hide internal directories.