jwt

package
v0.0.0-...-1bcb742 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomAccessClaims

type CustomAccessClaims struct {
	ID   string `json:"id"`
	Role uint32 `json:"role"`
	jwt.RegisteredClaims
}

type CustomRefreshClaims

type CustomRefreshClaims struct {
	ID string `json:"id"`
	jwt.RegisteredClaims
}

type JWT

type JWT struct {
	AccessSignKey  string
	RefreshSignKey string
	AccessExpire   time.Duration
	RefreshExpire  time.Duration
}

func NewJWT

func NewJWT(AccessSignKey, RefreshSignKey string, AccessExpire, RefreshExpire time.Duration) *JWT

func (*JWT) SignAccessToken

func (j *JWT) SignAccessToken(userID string, role uint32) (string, error)

func (*JWT) SignRefreshToken

func (j *JWT) SignRefreshToken(userID string) (string, error)

func (*JWT) ValidateAccessToken

func (j *JWT) ValidateAccessToken(token string) (string, uint32, error)

func (*JWT) ValidateRefreshToken

func (j *JWT) ValidateRefreshToken(token string) (string, error)

Jump to

Keyboard shortcuts

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