Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdminMiddleware ¶
func AdminMiddleware() gin.HandlerFunc
AdminMiddleware checks if the authenticated user has admin role
func AuthMiddleware ¶
func AuthMiddleware() gin.HandlerFunc
AuthMiddleware validates JWT token and sets user info in context
func GenerateJWT ¶
Generates signed JWTs from userID, username, email, and role
func ValidateEmail ¶
ValidateEmail checks if email format is valid
func ValidatePassword ¶
ValidatePassword checks if password meets all requirements
func ValidateUsername ¶
ValidateUsername checks if username is alphanumeric only
Types ¶
type Claims ¶
type Claims struct {
UserID string `json:"user_id"`
Username string `json:"username"`
Email string `json:"email"`
Role string `json:"role"`
jwt.RegisteredClaims
}
func ValidateJWT ¶
Validates a JWT tokenstring and returns claims and an error if any
Click to show internal directories.
Click to hide internal directories.