auth

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSignedJwt

func GenerateSignedJwt(userId int, email string, role types.UserRole, jwtSecret string) (string, error)

Types

type AuthHandlerImpl

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

func NewAuthHandler

func NewAuthHandler(store types.UserStore, logger *slog.Logger, jwtSecret string, requireVerification bool) *AuthHandlerImpl

func (*AuthHandlerImpl) GetMe

func (h *AuthHandlerImpl) GetMe(c fiber.Ctx) error

func (*AuthHandlerImpl) Login

func (h *AuthHandlerImpl) Login(c fiber.Ctx) error

func (*AuthHandlerImpl) Register

func (h *AuthHandlerImpl) Register(c fiber.Ctx) error

type AuthUserPayload

type AuthUserPayload struct {
	User_id   int            `json:"user_id"`
	Email     string         `json:"email"`
	User_role types.UserRole `json:"user_role"`
}

type JwtClaims

type JwtClaims struct {
	UserId   int
	Email    string
	UserRole types.UserRole
	jwt.RegisteredClaims
}

func VerifyJwt

func VerifyJwt(tokenString string, jwtSecret string) (*JwtClaims, error)

type LoginPayload

type LoginPayload struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

func (LoginPayload) Validate

func (p LoginPayload) Validate() error

type RegisterPayload

type RegisterPayload struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

func (RegisterPayload) Validate

func (p RegisterPayload) Validate() error

Jump to

Keyboard shortcuts

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