Skip to main content

Module builders

Module builders 

Source
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§

AuditBuilder
Sub-builder for audit logging settings.
AuthBuilder
Main builder for constructing an AuthFramework instance.
JwtBuilder
Sub-builder for JWT settings.
OAuth2Builder
Sub-builder for OAuth 2.0 client credentials.
QuickStartBuilder
Quick start builder for common authentication setups.
RateLimitBuilder
Sub-builder for rate limiting policy.
SecurityBuilder
Sub-builder for security settings (passwords, cookies, CSRF).
StorageBuilder
Sub-builder for storage backend selection.

Enums§

QuickStartAuth
Authentication method selection for QuickStartBuilder.
QuickStartFramework
Web framework integration selection for QuickStartBuilder.
QuickStartStorage
Storage backend selection for QuickStartBuilder.