middleware

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TokenExpired     error  = errors.New("Token has been expired ")
	TokenNotValidYet error  = errors.New("Token not active yet ")
	TokenMalformed   error  = errors.New("")
	TokenInvalid     error  = errors.New("Invalid token ")
	SignKey          string = "asdfg"
)

Functions

func GetSignKey

func GetSignKey() string

func JwtAuth

func JwtAuth() gin.HandlerFunc

func SetSignKey

func SetSignKey(key string) string

Types

type CustomClaims

type CustomClaims struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`

	jwt.StandardClaims
}

type Jwt

type Jwt struct {
	SigningKey []byte
}

func NewJwt

func NewJwt() *Jwt

func (*Jwt) CreateToken

func (j *Jwt) CreateToken(claim CustomClaims) (string, error)

func (*Jwt) ParseToken

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

func (*Jwt) RefreshToken

func (j *Jwt) RefreshToken(tokenString string) (string, error)

更新token

Jump to

Keyboard shortcuts

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