Documentation ¶
Index ¶
- func GetExpiry(tokenStr string, now time.Time) (expires bool, left time.Duration, err error)
- func GetUsername(tokenStr string) (username string, ok bool)
- func IsOrgAdmin(tokenStr string) bool
- func MapClaims(token *jwt.Token) (claims jwt.MapClaims, err error)
- func Parse(textToken string) (token *jwt.Token, err error)
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetUsername ¶
GetUsername extracts the username claim value from the JWT
func IsOrgAdmin ¶
IsOrgAdmin returns the value of the `is_org_admin` claim
Types ¶
type Token ¶
type Token struct { Logger logging.Logger AccessToken string `json:"access_token,omitempty" doc:"Bearer access token."` RefreshToken string `json:"refresh_token,omitempty" doc:"Offline or refresh token."` }
Token contains the current access and refresh tokens from the Authorization server
func (*Token) NeedsRefresh ¶
NeedsRefresh checks if the access token is missing, expired or nearing expiry and should be refreshed
Click to show internal directories.
Click to hide internal directories.