jwt

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(c *fiber.Ctx) error

func FromID

func FromID(id string) (string, error)

func New

func New(t *JWT) error

func Parser

func Parser(c *fiber.Ctx) error

Types

type JWT

type JWT struct {
	TZ       string        `yaml:"tz"`
	Secret   string        `yaml:"secret"`
	Expire   int           `yaml:"expire"`
	Refresh  int           `yaml:"refresh"`
	Duration time.Duration `yaml:"duration"`
}

type TYPE

type TYPE uint8 // Type de jeton
const (
	ACCESS  TYPE = 0 // Jeton d'accès
	REFRESH TYPE = 1 // Jeton de rafraîchissement
)

type Token

type Token struct {
	ID     string `json:"id"`
	Exp    int64  `json:"exp"`
	TZ     string `json:"tz"`
	Offset int    `json:"offset"`
	Type   TYPE   `json:"type"`

	Refresh *string `json:"refresh,omitempty"`
}

func TokenToClaims

func TokenToClaims(tokenString string) (*Token, error)

func (Token) Claims

func (a Token) Claims() jwt.MapClaims

func (*Token) HasExpired

func (t *Token) HasExpired() bool

func (*Token) HasRefresh

func (t *Token) HasRefresh() *Token

func (*Token) IsNotValid

func (t *Token) IsNotValid() bool

Jump to

Keyboard shortcuts

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