jwt

package
v5.10.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: MIT, MIT, MIT, + 1 more Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessToken

func AccessToken(claims *v2.Claims) (*jwt.Token, string, error)

AccessToken creates a new access token and returns it in both JWT and signed format, along with any error

func ExtractBearerToken

func ExtractBearerToken(r *http.Request) string

ExtractBearerToken retrieves the bearer token from a request and returns the JWT

func GenJTI

func GenJTI() (string, error)

GenJTI generates a new random JTI

func GetClaims

func GetClaims(token *jwt.Token) (*v2.Claims, error)

GetClaims returns the claims from a token

func GetClaimsFromContext

func GetClaimsFromContext(ctx context.Context) *v2.Claims

GetClaimsFromContext retrieves the JWT claims from the request context

func InitSecret

func InitSecret(store store.Store) error

InitSecret initializes and retrieves the secret for our signing tokens

func NewClaims

func NewClaims(user *v2.User) (*v2.Claims, error)

NewClaims creates new claim based on username

func RefreshToken

func RefreshToken(claims *v2.Claims) (*jwt.Token, string, error)

RefreshToken returns a refresh token for a specific user

func SetClaimsIntoContext

func SetClaimsIntoContext(r *http.Request, claims *v2.Claims) context.Context

SetClaimsIntoContext adds the token claims into the request context for easier consumption later

func ValidateExpiredToken

func ValidateExpiredToken(tokenString string) (*jwt.Token, error)

ValidateExpiredToken verifies that the provided token is valid, even if it's expired

func ValidateToken

func ValidateToken(tokenString string) (*jwt.Token, error)

ValidateToken verifies that the provided token is valid

Types

This section is empty.

Jump to

Keyboard shortcuts

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