token

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExpiry

func GetExpiry(tokenStr string, now time.Time) (expires bool,
	left time.Duration, err error)

func GetUsername

func GetUsername(tokenStr string) (username string, ok bool)

func MapClaims

func MapClaims(token *jwt.Token) (claims jwt.MapClaims, err error)

func Parse

func Parse(textToken string) (token *jwt.Token, err error)

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) IsValid

func (t *Token) IsValid() (tokenIsValid bool, err error)

func (*Token) NeedsRefresh

func (t *Token) NeedsRefresh() bool

NeedsRefresh checks if the access token is missing, expired or nearing expiry and should be refreshed

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL