auth

package
v1.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(appKey, appSecret string, i ClaimsInterface) (string, error)

func GenerateUserToken

func GenerateUserToken(user_id int, i ClaimsInterface) (string, error)

Types

type Claims

type Claims struct {
	AppKey    string `json:"app_key"`
	AppSecret string `json:"app_secret"`
	jwt.StandardClaims
}

func ParseToken

func ParseToken(token string, i ClaimsInterface) (*Claims, error)

type ClaimsInterface

type ClaimsInterface interface {
	GetJWTSecret() []byte
	GetJWTIssuer() string
	GetJWTExpireTime() int64
}

type UserClaims

type UserClaims struct {
	UserId int `json:"user_id"`
	jwt.StandardClaims
}

TODO: 待优化

func ParseUserToken

func ParseUserToken(token string, i ClaimsInterface) (*UserClaims, error)

Jump to

Keyboard shortcuts

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