middleware

package
v0.0.0-...-2bc4f80 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: Apache-2.0 Imports: 11 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")
)

Functions

func AdminAuth

func AdminAuth() gin.HandlerFunc

func Cors

func Cors() gin.HandlerFunc

func JWTAuth

func JWTAuth() gin.HandlerFunc

func OpenTracing

func OpenTracing() gin.HandlerFunc

func ResourceExtractor

func ResourceExtractor(c *gin.Context) string

Types

type CustomClaims

type CustomClaims struct {
	ID      int
	Company int
	Role    int
	jwt.StandardClaims
}

type JWT

type JWT struct {
	SigningKey []byte
	Expiration time.Duration
}

func NewJWT

func NewJWT() *JWT

func (*JWT) CreateToken

func (j *JWT) CreateToken(claims 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)

Jump to

Keyboard shortcuts

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