jwt

package
v0.0.0-...-e120e2b Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(userId *dt.ID, userName string, roles ...dt.Role) (string, error)

func SetSecret

func SetSecret(secret string)

func SetTokenValidityPeriod

func SetTokenValidityPeriod(duration time.Duration)

Types

type Claims

type Claims struct {
	UserId   *dt.ID    `json:"uid,omitempty"`
	UserName string    `json:"user,omitempty"`
	Roles    []dt.Role `json:"roles,omitempty"`
	jwt.RegisteredClaims
}

func ParseToken

func ParseToken(token string) (*Claims, error)

Jump to

Keyboard shortcuts

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