gojwt

package
v1.2.85 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJwtToken

func GetJwtToken(secretKey string, iat, seconds int64, params map[string]any) (string, error)

func Init added in v1.2.73

func Init(configs ...Config)

Types

type Config

type Config struct {
	Name               string `yaml:"Name" json:"name,optional"`
	AccessSecret       string `yaml:"AccessSecret" json:"accessSecret,optional"`
	AccessExpire       int64  `yaml:"AccessExpire" json:"accessExpire,optional"`
	RefreshTokenExpire int64  `yaml:"RefreshTokenExpire" json:"refreshTokenExpire,optional"`
}

type GoJwt

type GoJwt struct {
	Config Config
}

func Default added in v1.2.73

func Default() *GoJwt

func GetClient added in v1.2.73

func GetClient(names ...string) *GoJwt

func New added in v1.2.73

func New(config Config) *GoJwt

func (*GoJwt) GeneratedTokens

func (c *GoJwt) GeneratedTokens(params map[string]any) (accessToken, refreshToken string, expires int64, err error)

func (*GoJwt) IsValidToken

func (c *GoJwt) IsValidToken(tokenString string) bool

func (*GoJwt) ParseToken

func (c *GoJwt) ParseToken(tokenString string) (map[string]interface{}, error)

解析token

func (*GoJwt) RefreshAccessToken

func (c *GoJwt) RefreshAccessToken(refreshTokenStr string) (accessToken, refreshToken string, expires int64, err error)

验证Refresh Token并生成新的Access Token

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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