jwt

package
v0.0.0-...-63997f1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuthMiddleware

func NewAuthMiddleware(secret string) echo.MiddlewareFunc

Types

type AccessClaims

type AccessClaims struct {
	jwt.RegisteredClaims
	UserID int    `json:"user_id"`
	Role   string `json:"role"`
}

func GetClaims

func GetClaims(c echo.Context) *AccessClaims

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(secret string, accessExpiration time.Duration) *Service

func (*Service) GenerateToken

func (s *Service) GenerateToken(userID int, role string) (string, error)

func (*Service) GetAccessExpiration

func (s *Service) GetAccessExpiration() time.Duration

Jump to

Keyboard shortcuts

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