jwt

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetToken

func GetToken(c jwt.Claims, key string) (string, error)

GetToken 生成令牌公共方法

func MD5

func MD5(str string) string

MD5 md5大写hash

func MD516

func MD516(str string) string

MD516 获取16位md5结果

func RsaDecrypt

func RsaDecrypt(ciphertext []byte) ([]byte, error)

RsaDecrypt 解密

func RsaEncrypt

func RsaEncrypt(origData []byte) ([]byte, error)

RsaEncrypt 加密

func SHA256

func SHA256(str string) string

SHA256 获取字符串sha256结果

Types

type AppToken

type AppToken struct {
	jwt.StandardClaims
	AppFlag string `json:"application_flag"`
	AppId   string `json:"app_id"`
}

AppToken 应用令牌token

func ParseAppToken

func ParseAppToken(tokenString string) (*AppToken, error)

ParseAppToken 解析企业令牌

func (*AppToken) GetToken

func (a *AppToken) GetToken() (token string, err error)

GetToken 加密生成应用令牌

type UserToken

type UserToken struct {
	jwt.StandardClaims
	SubId           string `json:"sub_id"`
	ApplicationFlag string `json:"application_flag"`
	Timestamp       int64  `json:"timestamp"`
}

UserToken 用户令牌ticket 数据

func ParseUserToken

func ParseUserToken(tokenString string) (*UserToken, error)

ParseUserToken 解析用户令牌

func (*UserToken) GetToken

func (u *UserToken) GetToken() (token string, err error)

GetToken 生成jwt令牌

Jump to

Keyboard shortcuts

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