auth

package
v0.0.0-...-0563568 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthService

type AuthService struct {
	DB *sql.DB
	// contains filtered or unexported fields
}

func NewAuthService

func NewAuthService(jwtKey []byte, db *sql.DB) *AuthService

func (*AuthService) GenerateJWT

func (s *AuthService) GenerateJWT(userId uint) (string, error)

func (*AuthService) Login

func (h *AuthService) Login(c *gin.Context)

func (*AuthService) ParseToken

func (s *AuthService) ParseToken(tokenString string) (*jwt.Token, error)

func (*AuthService) Register

func (h *AuthService) Register(c *gin.Context)

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email" binding:"required,email"`
	Password string `json:"password" binding:"required"`
}

type RegisterRequest

type RegisterRequest struct {
	Password string `json:"password" binding:"required"`
	Email    string `json:"email" binding:"required,email"`
}

Jump to

Keyboard shortcuts

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