jwts

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 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, sub string, payload string) (string, error)

@secretKey: JWT 加解密密钥 @iat: 时间戳 @seconds: 过期时间,单位秒 @payload: 数据载体

func JwtCommonCreateToken

func JwtCommonCreateToken(exp int, UserId uint, key string, loginTime time.Time) (string, int64, error)

func JwtWithDomainCreateToken

func JwtWithDomainCreateToken(exp int, UserId, TenantID uint, privateKey string, loginTime time.Time) (string, int64, error)

func JwtWithoutDomainCreateToken

func JwtWithoutDomainCreateToken(exp int, UserId uint, privateKey string, loginTime time.Time) (string, int64, error)

Types

type JwtCommonClaims

type JwtCommonClaims struct {
	UserId    uint
	LoginTime time.Time
	jwt.StandardClaims
}

type JwtWithDomainCustomClaims

type JwtWithDomainCustomClaims struct {
	UserId    uint
	TenantID  uint
	LoginTime time.Time
	jwt.StandardClaims
}

func JwtWithDomainParseToken

func JwtWithDomainParseToken(tokenString, pubKey string) (*JwtWithDomainCustomClaims, error)

解析 token

type JwtWithoutDomainClaims

type JwtWithoutDomainClaims struct {
	UserId    uint
	LoginTime time.Time
	jwt.StandardClaims
}

func JwtCommonParseToken

func JwtCommonParseToken(tokenString, key string) (*JwtWithoutDomainClaims, error)

解析 token

func JwtWithoutDomainParseToken

func JwtWithoutDomainParseToken(tokenString, pubKey string) (*JwtWithoutDomainClaims, error)

解析 token

Jump to

Keyboard shortcuts

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