jwt

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(user authContext.User, sessionToken string, sessionInterval time.Duration) (string, error)

CreateToken creates a new signed jwt token with the user information saved in the claims.

func ValidateToken

func ValidateToken(tokenString, sessionToken string) (*authContext.User, error)

ValidateToken validates a given jwt token and returns the user from the claims or an error when the validation fails.

Types

type CustomClaims

type CustomClaims struct {
	User authContext.User
	goJWT.RegisteredClaims
}

CustomClaims is the struct which defines the claims for our jwt tokens.

Jump to

Keyboard shortcuts

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