auth

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Jwt

type Jwt struct {
	Secret []byte // 密钥
	Expire int64  // 有效期(分钟)
	jwt.StandardClaims
}

func NewJwt

func NewJwt(secret string, expire int64) *Jwt

NewJwt 有效期时长默认2小时

func (Jwt) Check

func (t Jwt) Check(strToken string) (bool, error)

Check 校验是否有效

func (Jwt) Create

func (t Jwt) Create() (string, error)

Create 生成JWT

func (Jwt) GetAudience

func (t Jwt) GetAudience() string

GetAudience 返回受众群体

func (Jwt) Parse

func (t Jwt) Parse(strToken string) (jwt.MapClaims, error)

Parse 解析JWT

Jump to

Keyboard shortcuts

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