middleware

package
v0.0.0-...-9cb7876 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TokenExpired     = errors.New("Token is expired")
	TokenNotValidYet = errors.New("Token not active yet")
	TokenMalformed   = errors.New("That's not even a token")
	TokenInvalid     = errors.New("Couldn't handle this token")
	TokenIsEmpty     = errors.New("Couldn't find the token")
)

Functions

func CheckoutSession

func CheckoutSession(c *gin.Context) (*request.CustomClaims, error)

func Cors

func Cors() gin.HandlerFunc

func GetRedisJWT

func GetRedisJWT(userID uint) (string, error)

GetRedisJWT .

func JWTAuth

func JWTAuth() gin.HandlerFunc

func SetRedisJWT

func SetRedisJWT(jwt string, userID uint) error

SetRedisJWT .

func SignJwt

func SignJwt(userID uint) (string, int64, error)

Types

type JWT

type JWT struct {
	SigningKey []byte
}

func NewJWT

func NewJWT() *JWT

func (*JWT) CreateToken

func (j *JWT) CreateToken(claims request.CustomClaims) (string, error)

CreateToken .

func (*JWT) ParseToken

func (j *JWT) ParseToken(tokenString string) (*request.CustomClaims, error)

ParseToken .

Jump to

Keyboard shortcuts

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