Expand description
Ergonomic builders and prelude for better developer experience. Builder patterns and ergonomic helpers for the Auth Framework
This module provides fluent builder APIs and helper functions to make common authentication setup tasks easier and more discoverable.
§Quick Start Builders
For the most common setups, use the quick start builders:
use auth_framework::prelude::*;
// Simple JWT auth with environment variables
let auth = AuthFramework::quick_start()
.jwt_auth_from_env()
.build().await?;
// Web app with database
let auth = AuthFramework::quick_start()
.jwt_auth("your-secret-key")
.with_postgres("postgresql://...")
.with_axum()
.build().await?;§Preset Configurations
Use presets for common security and performance configurations:
use auth_framework::prelude::*;
let auth = AuthFramework::builder()
.security_preset(SecurityPreset::HighSecurity)
.performance_preset(PerformancePreset::LowLatency)
.build().await?;§Use Case Templates
Get started quickly with templates for common use cases:
use auth_framework::prelude::*;
// Configure for web application
let auth = AuthFramework::for_use_case(UseCasePreset::WebApp)
.customize(|config| {
config.token_lifetime = hours(24);
config
})
.build().await?;Structs§
- Audit
Builder - Sub-builder for audit logging settings.
- Auth
Builder - Main builder for constructing an
AuthFrameworkinstance. - JwtBuilder
- Sub-builder for JWT settings.
- OAuth2
Builder - Sub-builder for OAuth 2.0 client credentials.
- Quick
Start Builder - Quick start builder for common authentication setups.
- Rate
Limit Builder - Sub-builder for rate limiting policy.
- Security
Builder - Sub-builder for security settings (passwords, cookies, CSRF).
- Storage
Builder - Sub-builder for storage backend selection.
Enums§
- Quick
Start Auth - Authentication method selection for
QuickStartBuilder. - Quick
Start Framework - Web framework integration selection for
QuickStartBuilder. - Quick
Start Storage - Storage backend selection for
QuickStartBuilder.