Module auth

Module auth 

Source
Expand description

Authentication and JWT token management

This module provides authentication endpoints and JWT token generation/validation for the Admin UI.

§Features

  • JWT token generation and validation
  • Password hashing with bcrypt
  • Rate limiting for login attempts
  • In-memory user store (can be replaced with database)

§Database Integration

See auth/database.rs for database-backed user store implementation.

Structs§

Claims
JWT claims structure
LoginRequest
Login request
LoginResponse
Login response
PasswordPolicy
Password policy configuration
RefreshTokenRequest
Refresh token request
UserInfo
User information
UserStore
In-memory user store (in production, use database)

Enums§

PasswordValidationError
Password validation errors

Functions§

claims_to_user_context
Convert Claims to UserContext
generate_refresh_token
Generate refresh token
generate_token
Generate JWT token
get_current_user
Get current user endpoint
get_global_user_store
Get the global user store
init_global_user_store
Initialize the global user store
login
Login endpoint
logout
Logout endpoint (client-side token removal, but can invalidate refresh tokens)
refresh_token
Refresh token endpoint
validate_token
Validate JWT token