jwt

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ROLE_ADMIN = "admin"
)

Variables

This section is empty.

Functions

func GenerateNewToken

func GenerateNewToken(userID string, experiresIn time.Duration, roles []string) (string, error)

GenerateNewToken create and signes a new token

Types

type UserClaims

type UserClaims struct {
	ID    string   `json:"id,omitempty"`
	Roles []string `json:"roles,omitempty"`
	jwt.StandardClaims
}

UserClaims - Information a token enocodes

func ValidateToken

func ValidateToken(tokenString string) (claims *UserClaims, valid bool, err error)

ValidateToken parses and validates the token string

Jump to

Keyboard shortcuts

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