authorization

package
v0.7.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckTokenAuth

func CheckTokenAuth() gin.HandlerFunc

func CreateUserTokenFactory

func CreateUserTokenFactory() *userToken

func RefreshTokenConditionCheck

func RefreshTokenConditionCheck() gin.HandlerFunc

Types

type CustomClaims

type CustomClaims struct {
	UserId   int64  `json:"user_id"`
	Name     string `json:"name"`
	UserType string `json:"user_type"`
	OrgId    int64  `json:"org_id"`
	jwt.StandardClaims
}

func (*CustomClaims) GetOrgIdForTest

func (c *CustomClaims) GetOrgIdForTest() int64

GetOrgIdForTest 主要是在测试的时候使用.

type HeaderParams

type HeaderParams struct {
	Authorization string `header:"Authorization" binding:"required,min=20"`
}

type JwtSign

type JwtSign struct {
	SigningKey []byte
}

func CreateJWT

func CreateJWT(signKey string) *JwtSign

func (*JwtSign) CreateToken

func (j *JwtSign) CreateToken(claims CustomClaims) (string, error)

func (*JwtSign) ParseToken

func (j *JwtSign) ParseToken(tokenString string) (*CustomClaims, error)

func (*JwtSign) RefreshToken

func (j *JwtSign) RefreshToken(tokenString string, extraAddSeconds int64) (string, error)

Jump to

Keyboard shortcuts

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