jwtx

package
v1.2.50 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAccessSecret = "jwtx"
	DefaultAccessExpire = 3 * 24 * 60 * 60 // 三天
)

Variables

This section is empty.

Functions

This section is empty.

Types

type JwtClaims

type JwtClaims struct {
	UserID    int    `json:"user_id"`
	OrgID     int    `json:"dept_id"`
	RoleID    int    `json:"role_id"`
	Username  string `json:"username"`
	Account   string `json:"account"`
	ProjectID int    `json:"projectID,omitempty"` // 项目ID
	jwt.StandardClaims
}

type JwtMould

type JwtMould struct {
	SecretKey    string
	AccessExpire int64
}

func DefaultJwt

func DefaultJwt() *JwtMould

func Jwt

func Jwt(AccessSecret string, AccessExpire int64) *JwtMould

func (*JwtMould) Claims

func (j *JwtMould) Claims(r *http.Request) *JwtClaims

func (*JwtMould) ClaimsToken

func (j *JwtMould) ClaimsToken(auth string) *JwtClaims

func (*JwtMould) GetClaims

func (j *JwtMould) GetClaims(authorization string) *JwtClaims

func (*JwtMould) Token

func (j *JwtMould) Token(userid int, username, account string, roleID int, orgID int) (string, error)

func (*JwtMould) UpdateToken

func (j *JwtMould) UpdateToken(token *JwtClaims) (string, error)

Jump to

Keyboard shortcuts

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