auth

package
v0.0.0-...-9042724 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenExpired     = errors.New("token is expired")
	ErrTokenNotValidate = errors.New("token not active yet")
	ErrTokenMalformed   = errors.New("that's not even a token")
	ErrTokenInvalid     = errors.New("token signature is invalid")
)

Functions

func New

func New() fiber.Handler

func ParseDuration

func ParseDuration(d string) (time.Duration, error)

Types

type BaseClaims

type BaseClaims struct {
	UUID     uuid.UUID
	ID       uint   `json:"id"`
	Name     string `json:"name"`
	LastName string `json:"last_name"`
	Role     string `json:"role"`
	// contains filtered or unexported fields
}

type CustomClaims

type CustomClaims struct {
	BaseClaims
	BufferTime int64
	jwt.RegisteredClaims
}

type JWT

type JWT struct {
	SigningKey []byte
}

func NewJWT

func NewJWT() (*JWT, error)

func (*JWT) CreateClaims

func (j *JWT) CreateClaims(baseClaims BaseClaims) (CustomClaims, error)

func (*JWT) CreateToken

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

func (*JWT) ValidateToken

func (j *JWT) ValidateToken(tokenString string) (*jwt.Token, jwt.MapClaims, error)

Jump to

Keyboard shortcuts

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