jwt

package
v0.0.0-...-f4dd3ec Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessClaims

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

type AuthLevel

type AuthLevel string
const (
	Unknown    AuthLevel = "unknown"
	Guest      AuthLevel = "guest"
	User       AuthLevel = "user"
	Student    AuthLevel = "student"
	Instructor AuthLevel = "instructor"
	Moderator  AuthLevel = "moderator"
	Admin      AuthLevel = "admin"
)

type Service

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

func NewService

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

func (*Service) GenerateCode

func (s *Service) GenerateCode() int

func (*Service) GenerateRefreshToken

func (s *Service) GenerateRefreshToken() (string, error)

func (*Service) GenerateToken

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

func (*Service) GetAccessExpiration

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

func (*Service) GetRefreshExpiration

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

Jump to

Keyboard shortcuts

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