Module builders

Module builders 

Source
Expand description

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::new()
    .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))
              .enable_sessions(true)
    })
    .build().await?;

Structs§

AuditBuilder
Audit configuration builder
AuthBuilder
Main builder for AuthFramework with fluent API
JwtBuilder
JWT configuration builder
OAuth2Builder
OAuth2 configuration builder
QuickStartBuilder
Quick start builder for common authentication setups
RateLimitBuilder
Rate limiting configuration builder
SecurityBuilder
Security configuration builder
StorageBuilder
Storage configuration builder

Enums§

QuickStartAuth
Authentication method configuration for quick start
QuickStartFramework
Web framework integration for quick start
QuickStartStorage
Storage configuration for quick start