jwt

package
v1.0.31 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const AuthUserKey = "authUser"

Variables

This section is empty.

Functions

func ParseAuthHeader

func ParseAuthHeader(c *gin.Context) (string, error)

Types

type Claims

type Claims struct {
	Id    int
	Login string
	Role  string
	Token string
}

type JWT

type JWT struct {
	Key      []byte
	Duration time.Duration
	Algo     string
}

func NewJWT

func NewJWT(signingKey string, accessTokenTTL time.Duration, signingAlgorithm string) *JWT

func (*JWT) Authenticate

func (j *JWT) Authenticate(c *gin.Context)

func (*JWT) GenerateToken

func (j *JWT) GenerateToken(u Claims) (string, float64, error)

func (*JWT) ParseToken

func (j *JWT) ParseToken(token string) (*Claims, error)

Jump to

Keyboard shortcuts

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