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
- Login
Request - Login request
- Login
Response - Login response
- Password
Policy - Password policy configuration
- Refresh
Token Request - Refresh token request
- User
Info - User information
- User
Store - In-memory user store (in production, use database)
Enums§
- Password
Validation Error - 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