jwt

package
v6.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token struct {
	ExpiryDate int64
	RawToken   string
}

Token is the jwt that will be used by the client in the Authorization header to send in every request to the api server, every request except for the auth request which is used to request a new token.

For more information see: https://jwt.io/

func New

func New(token string) (Token, error)

New expects a raw token as string. It will try to decode it and return an error on error. Once decoded it will retrieve the expiry date and return a Token struct with the RawToken and ExpiryDate set.

func (*Token) Expired

func (t *Token) Expired() bool

Expired returns true when the token expiry date is reached

func (*Token) GetAuthenticationHeaderValue

func (t *Token) GetAuthenticationHeaderValue() string

GetAuthenticationHeaderValue returns the authentication header value value including the Bearer prefix

func (*Token) String

func (t *Token) String() string

String returns the string representation of the Token struct

Jump to

Keyboard shortcuts

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