Auth Framework

🏆 The Most Complete Authentication & Authorization Framework for Rust
Security-first • Feature-rich • Batteries-included • Release candidate
⚡ Quick Start - Get Running in Seconds
No Rust installation required! Use our precompiled binaries:
# Linux/macOS - One-line installation
|
# Windows PowerShell - One command
|
# Docker - Instant deployment
That's it! Server running at http://localhost:8080 🎉
📖 Full Deployment Guide • 🐳 Docker Deployment • 🛠️ Configuration Guide • 🧰 Maintenance Operations Guide
📚 Feature Flags Guide • Supported Protocols
Auth Framework is a comprehensive authentication and authorization framework for Rust applications. The project is aimed at production deployments, but as an active release candidate it should still be validated against your environment, storage, TLS, and operational requirements before rollout.
API Orientation
If you are integrating the Rust library directly, start with these entry points:
auth_framework::AuthFramework: recommended default entry point for most applications.auth_framework::ModularAuthFramework: advanced entry point when you need direct access to individual managers.auth_framework::prelude::*: ergonomic imports for application code.auth_framework::AppConfigBuilder: simple in-process configuration builder.auth_framework::LayeredConfigBuilderandauth_framework::ConfigManager: layered configuration from files and environment variables.
This split exists to support both simple app integration and advanced composition, but new users should usually start with AuthFramework plus the prelude.
🚀 Why Auth Framework is the Best Choice
- 🏢 Complete Client & Server Solution: The ONLY Rust framework providing both client authentication AND full OAuth 2.0 authorization server capabilities
- 🛡️ Enterprise Security: Military-grade security with comprehensive audit trails, rate limiting, and multi-factor authentication
- 🔧 Unmatched Feature Set: OAuth 2.0 server, OIDC provider, JWT server, SAML SP, WebAuthn RP, API gateway, and more
- 📊 Production Proven: CI-verified test suites with detailed results published in
docs/development/TESTING_RESULTS.md - ⚡ High Performance: Optimized for speed with async-first design and efficient memory usage
- 🌍 Framework Agnostic: Seamless integration with Axum, Actix Web, Warp, and any Rust web framework
- 🔒 Zero-Trust Architecture: Built from the ground up with security-first principles and defense in depth
- 📚 Developer Experience: Comprehensive documentation, examples, and testing utilities for rapid development
🔐 Security Notice: This framework requires a JWT secret to be configured before use. See
SECURITY_GUIDE.mdfor critical security requirements and best practices.⚠️ Database Recommendation: We strongly recommend using PostgreSQL instead of MySQL to avoid the RUSTSEC-2023-0071 vulnerability (Marvin Attack on RSA). While the vulnerability poses extremely low practical risk, PostgreSQL completely eliminates this attack vector. See
SECURITY.mdfor details.
🆕 What's New in Latest Version
Historical release notes below include the test counts and quality metrics reported at the time of each release candidate. The current authoritative test status lives in docs/development/TESTING_RESULTS.md and the CI workflow.
v0.5.0-rc18 - Security Hardening & Comprehensive Audit:
- 🔒 WebAuthn credential endpoints secured - List/delete credential endpoints now require authentication with owner-only authorization
- 🔒 JWT validation hardened - Removed dangerous
verify_signatureparameter; signature verification is now always enforced - 🔒 Content-Security-Policy header added - Complete security headers suite now includes CSP
- 🛡️ Production panic prevention - Replaced all
unwrap()/expect()on mutex/RwLock operations with graceful fallback handling - 🐛 SAML integration tests guarded - Added
#[cfg(feature = "saml")]to SAML-specific tests
Previous: v0.5.0-rc6 - Storage Backend Correctness (audit cycle 13):
- 🐛 PostgreSQL
migrate()DDL fixes - The existingmigrate()method contained two bugs: all threeCREATE TABLEstatements were passed to a singlesqlx::query()call (sqlx accepts exactly one statement per call), and inlineINDEXclauses were used insideCREATE TABLE(valid MySQL syntax but not PostgreSQL). Fixed by splitting into individualexecute()calls and replacing inline indexes with separateCREATE INDEX IF NOT EXISTSstatements. - 🆕 MySQL
migrate()added -MySqlStoragelacked amigrate()method entirely; a new empty database would immediately fail on first use ("Table doesn't exist"). AddedMySqlStorage::migrate()with proper MySQL DDL (DATETIME(6),JSON,LONGTEXT,ENGINE=InnoDB utf8mb4), matching the PostgreSQL API exactly. - 🧪 1,900+ tests, 0 clippy warnings
Previous: v0.5.0-rc5 - Integration Fixes & Lint Compliance (audit cycle 12):
- 🐛 Integration compile fixes -
Permission→AbacPermissionin actix-web and warp integration modules (broken since rc2 type rename; previously hidden by feature gates) - 📅 CHANGELOG date corrections - rc3 and rc4 entries were dated 2025-10-07 (before rc2); all corrected to 2026-03-12
- 🔧 Idiomatic
_configfields - Removed#[allow(dead_code)]suppressions in analytics structs; replaced with underscore-prefix convention - 📝
.markdownlint.json- Added project-level config to allow repeated subsection headings across CHANGELOG version sections (Keep a Changelog standard) - 🧪 1,900+ tests, 0 clippy warnings
Previous: v0.5.0-rc4 - Code Quality & Version Sync (audit cycle 11):
- 🔧 Mutex Safety - All
.lock().unwrap()calls in production code replaced with.expect("mutex poisoned")for clearer diagnostics if a mutex is poisoned - 📚 Documented Initialize Stubs -
initialize()methods inJwtServer,ApiGateway, andSamlIdentityProvidernow have doc comments explaining they are intentionally empty (all async setup is done innew()) - 🔢 Version Consistency -
Cargo.tomlandREADME.mdnow correctly reflect the current release candidate (were stale at rc1) - 📝 README Fix - Corrected a markdown fence that was touching a blockquote on the same line, causing MD040 lint errors
- 🧪 1,900+ tests, 0 clippy warnings
Previous: v0.5.0-rc3 - CIBA Spec Compliance & Quality Improvements:
- 🔐 CIBA Spec §7.1 / §11 Conformance -
client_notification_tokenis now forwarded asAuthorization: Bearerin ping/push mode notifications, with validation that the token is present when required - 🔧 Production-Grade Implementations - Replaced all development stubs in auth.rs and authorization.rs with real implementations (TOTP secret retrieval, security metrics, instance ID, UTC time-range checks)
- 📚 Doc-Test Completeness - 41 documentation examples now compiled with
no_run(up from 0 passing doc-tests in rc2) - 🧪 Test Suite Excellence - 1,900+ tests total, 100% passing (unit + integration + 41 doctests)
- 🔒 Code Quality - All production
.unwrap()calls replaced with.expect()with descriptive messages;initialize()stubs documented
Previous: v0.5.0-rc2 - Security Audit Cycle:
- Comprehensive security audit with 9 audit cycles; all critical/high findings resolved
- 483 tests, 0 clippy warnings, full OWASP Top 10 compliance
Previous: v0.5.0-rc1 - OAuth 2.1 Complete Implementation & Enhanced Security:
- 🔐 OAuth 2.1 Full Compliance - Complete OAuth 2.1 authorization server implementation
- Token Introspection (RFC 7662) - 9 comprehensive tests
- Pushed Authorization Requests / PAR (RFC 9126) - 9 comprehensive tests
- Device Authorization Flow (RFC 8628) - 14 comprehensive tests
- End-to-end OAuth 2.1 flows - 9 integration tests
- 41 OAuth tests total, 100% passing
- 🛡️ Advanced Security Features - Production-grade security enhancements
- Rate Limiting - 12 tests covering burst protection and distributed systems
- DoS Protection - 10 tests including Slowloris defense and resource exhaustion
- IP Blacklisting - 12 tests for threat prevention and geolocation blocking
- MFA Flows - 18 tests covering TOTP, enrollment, and recovery
- 52 security tests total, 100% passing
- 📊 Test Suite Excellence - 93 comprehensive tests (100% passing)
- 🏗️ Production Ready - Complete authorization server capabilities
Previous Release (v0.5.0-alpha) - Phase 2: Password & Email Validation Complete:
- 🔐 Enhanced Password Validation - Completely overhauled password validation system with granular complexity requirements
- Added 8 new SecurityConfig fields for fine-grained password policy control
- Advanced minimum complexity criteria system (meet N of 4 possible criteria)
- Individual requirement toggles for maximum flexibility
- Maintains full backward compatibility
- � RFC 5322 Email Validation - Industry-standard email validation using
email_addresscrate- Full RFC 5322 compliance for professional-grade email format validation
- Advanced parsing with configurable options
- Comprehensive edge case handling for production use
- ⚙️ Configuration System Overhaul - Enhanced SecurityConfig with comprehensive security controls
- Added
LockoutConfigstructure for account lockout management - Added
OAuth2SecurityConfigfor OAuth2-specific security settings - Enhanced helper methods with all new security fields
- Added
- 🧪 Enhanced Test Suite - 405 passing tests with comprehensive validation coverage
- 12 new validation tests covering all enhancement scenarios
- Password complexity criteria testing with various combinations
- Email validation testing with valid/invalid cases and edge cases
Previous Release (v0.4.2):
- 393 passing tests with 100% success rate, comprehensive error handling improvements
- Security utilities rebuild, enhanced email validation, improved password security
Previous Major Features (v0.3.0):
- 🔧 Flexible Configuration Management - Complete integration with
configcrate for multi-format configuration support - 📁 Modular Configuration System - Include directives for breaking configuration into logical components
- 🌍 Environment Variable Support - Comprehensive environment variable mapping with precedence control
- ⚙️ CLI Integration - Command-line argument parsing with clap integration
- 🏗️ Parent App Integration - Seamless nesting of auth-framework config into larger applications
- 🔄 Configuration Layering - Smart precedence: CLI → Environment → Files → Defaults
- 🚨 Automated Threat Intelligence - Real-time threat feed updates with MaxMind GeoIP2 integration
- 🛡️ Enhanced Security Features - Advanced rate limiting, IP geolocation tracking, and threat detection
- 📚 Comprehensive Documentation - Configuration guides, integration examples, and best practices
- 🧪 Deployment Examples - Docker, Kubernetes, and multi-environment configuration patterns
Configuration Highlights:
- Multiple Format Support: TOML, YAML, JSON configuration files
- Environment Integration: Full environment variable mapping with customizable prefixes
- Modular Architecture: Include files for organized, maintainable configuration
- Parent App Friendly: Easy integration into existing application configuration systems
Features
🔐 Complete Authentication Arsenal
- Client & Server Capabilities: Full OAuth 2.0/2.1 client AND authorization server, OpenID Connect provider, JWT server
- Multiple Authentication Methods: OAuth 2.0/OIDC, JWT, API keys, password-based, SAML, WebAuthn, and custom methods
- Enhanced Device Flow: Complete OAuth device flow support (client & server) with
oauth-device-flowsintegration - Multi-Factor Authentication: TOTP, SMS, email, hardware keys, and backup codes with configurable policies
- Enterprise Identity Providers: GitHub, Google, Microsoft, Discord, and custom OAuth providers with automatic profile mapping
🏢 Authorization Server Capabilities
- OAuth 2.0 Authorization Server: Complete RFC 6749 implementation with all grant types (authorization code, client credentials, refresh token, device flow)
- OpenID Connect Provider: Full OIDC 1.0 provider with ID tokens, UserInfo endpoint, and discovery
- Dynamic Client Registration: RFC 7591 compliant client registration and management
- Advanced Grant Types: Device authorization flow (RFC 8628), JWT bearer tokens (RFC 7523), SAML bearer assertions (RFC 7522)
- Enterprise Features: Token introspection (RFC 7662), token revocation (RFC 7009), PKCE (RFC 7636), and consent management
🛡️ Enterprise-Grade Security
- Advanced Token Management: Secure issuance, validation, refresh, and revocation with JWT/JWE support
- Zero-Trust Session Management: Secure session handling with rotation, fingerprinting, and concurrent session limits
- Comprehensive Rate Limiting: Built-in protection against brute force, credential stuffing, and abuse
- Audit & Compliance: Detailed audit logging, GDPR compliance features, and security event monitoring
- Cryptographic Security: bcrypt password hashing, secure random generation, and constant-time comparisons
🏗️ Production Infrastructure
- Complete Server Stack: OAuth 2.0 server, OIDC provider, JWT server, SAML SP, WebAuthn RP, and API gateway
- Multiple Storage Backends: PostgreSQL (recommended), Redis (high-performance), MySQL, in-memory (development) with connection pooling
- Framework Integration: Native middleware for Axum, Actix Web, Warp, and extensible for any framework
- Distributed Architecture: Cross-node authentication validation and distributed rate limiting
- Permission System: Role-based access control (RBAC) with fine-grained permissions and attribute-based access control (ABAC)
- Performance Optimized: Async-first design, efficient memory usage, and optimized for high-throughput applications
🧪 Developer Excellence
- Comprehensive Testing: 1,900+ passing tests with extensive coverage of OAuth 2.1, security, and integration scenarios
- Mock Testing Framework: Built-in testing utilities with configurable mocks and test helpers
- Rich Documentation: Complete API docs, security guides, and real-world examples
- Type Safety: Leverages Rust's type system for compile-time security guarantees
- Error Handling: Comprehensive error types with detailed context and recovery suggestions
- Enhanced Reliability: OAuth 2.1 compliance, advanced security features, and comprehensive validation
🆕 Grouped Operation Accessors
AuthFramework exposes its surface through focused, discoverable accessor methods so common operations
are easy to find and autocomplete works effectively:
use *;
# async
The full set of accessor groups is:
| Accessor | Purpose |
|---|---|
auth.users() |
Register, look up, and manage user accounts |
auth.sessions() |
Create, retrieve, and delete sessions |
auth.tokens() |
Issue, validate, refresh, and revoke tokens and API keys |
auth.authorization() |
Permission checks, role and policy management |
auth.mfa() |
TOTP, SMS, email, and backup-code MFA flows |
auth.monitoring() |
Health, metrics, rate-limit status |
auth.audit() |
Permission logs and security statistics |
auth.admin() |
ABAC policies, role inheritance, resource delegation |
Import auth_framework::prelude::* to bring all types into scope at once.
Device Flow Credential Constructors
Security & Reliability
- 🔒 Security Audited: Comprehensive security review with no critical vulnerabilities
- 🧪 Battle Tested: 1,900+ passing tests with extensive integration and security testing
- ⚡ Performance Validated: Benchmarked for high-throughput production environments
- 🛡️ CVE-Free: Clean security record with proactive vulnerability management
- 📋 Compliance Ready: GDPR, SOC 2, and enterprise compliance features built-in
Industry Recognition
- 🥇 Most Complete: The ONLY Rust auth framework with full client AND server capabilities (OAuth 2.0 server, OIDC provider, SAML SP)
- 🏢 Enterprise Ready: Complete authorization server solution rivaling commercial products like Auth0, Okta, and AWS Cognito
- 🔧 Developer Friendly: Extensive documentation, examples, and testing utilities for both client and server implementations
- 🌍 Production Scale: Designed for enterprise-grade mission-critical applications requiring custom authorization servers
- 📈 Performance Leader: Engineered for performance — designed to compete with commercial solutions using Rust's speed and memory efficiency
- 🔄 Future Proof: Designed for extensibility with support for emerging standards and protocols
🆕 Enhanced Device Flow (Now More Convenient)
Convenience constructors for device flow credentials:
use ;
// Create device flow credential with minimal code
let credential = enhanced_device_flow;
// Or with a client secret if needed
let credential = enhanced_device_flow_with_secret;
// Complete a device flow with a device code
let credential = enhanced_device_flow_complete;
Quick Start
Add this to your Cargo.toml:
[]
= "0.5.0-rc18"
= { = "1.0", = ["full"] }
Basic Usage
use ;
use ;
use Duration;
async
🏢 OAuth 2.0 Authorization Server
Build your own OAuth 2.0 authorization server in minutes:
use ;
use Arc;
async
🔐 OpenID Connect Provider
Provide OpenID Connect authentication for your applications:
use ;
use Arc;
async
OAuth Authentication
Note: OAuth authentication is currently implemented through provider configurations and server components. For complete OAuth client flows, see the server examples in
examples/oauth2_authorization_server.rsandexamples/complete_oauth2_server_axum.rs.
use OAuthProvider;
// OAuth providers are available for server implementations
let github_provider = GitHub;
let google_provider = Google;
// Build authorization URLs for OAuth flows
let auth_url = github_provider.build_authorization_url?;
println!;
// Exchange code for tokens (server-side)
let token_response = github_provider.exchange_code.await?;
println!;
API Key Authentication
use ;
// Set up API key authentication
auth.register_method;
// Create a user and mint an API key for that user
let user_id = auth
.register_user
.await?;
// Create an API key for a user
let api_key = auth
.create_api_key
.await?;
println!;
// Authenticate with API key
let credential = api_key;
let result = auth.authenticate.await?;
Multi-Factor Authentication
// Enable MFA in configuration
let config = new
.enable_multi_factor;
// Authentication with MFA
let credential = password;
let result = auth.authenticate.await?;
match result
Permission Management
use ;
// Permission checking is built into the AuthFramework
// Create a test token first
let token = auth.create_auth_token.await?;
// Check permissions
let can_read = auth.check_permission.await?;
let can_write = auth.check_permission.await?;
let can_delete = auth.check_permission.await?;
println!;
Storage Configuration
Security Recommendation: Use PostgreSQL for optimal security. PostgreSQL eliminates the RUSTSEC-2023-0071 vulnerability present in MySQL storage.
PostgreSQL Storage (Recommended)
use ;
let config = new
.storage;
Redis Storage
use ;
let config = new
.storage;
Custom Storage
use AuthStorage;
use AuthToken;
;
// Use your custom storage
let storage = new;
let auth = new_with_storage;
Rate Limiting
use RateLimitConfig;
let config = new
.rate_limiting;
Middleware Integration
Axum Integration
use ;
async
Actix Web Integration
use ;
use BearerAuth;
async
Device Flow Authentication
Device flow is supported through the provider implementations. See the OAuth server examples for complete device flow implementations:
use OAuthProvider;
async
Configuration
Auth-framework provides flexible configuration management using the config crate, supporting multiple formats, environment variables, and modular organization.
Configuration Methods
- Configuration Files - TOML, YAML, JSON formats supported
- Environment Variables - Automatic mapping with customizable prefixes
- Command Line Arguments - CLI overrides using clap integration
- Include Directives - Modular configuration organization
Quick Start Configuration
# auth-framework.toml
[]
= "${JWT_SECRET_KEY:development-secret}"
= "HS256"
= "1h"
[]
= "AUTH_SESSION"
= true
= "myapp.com"
# Include method-specific configurations
= [
"methods/oauth2.toml",
"methods/mfa.toml",
"methods/jwt.toml"
]
Using ConfigManager in Code
use ;
async
Environment Variable Mapping
The framework automatically maps environment variables:
# JWT Configuration
# OAuth2 Configuration
# Session Configuration
Modular Configuration Structure
Organize configuration into logical modules:
config/
├── auth-framework.toml # Main configuration with includes
├── threat-intel.toml # Threat intelligence settings
├── session.toml # Session management configuration
└── methods/ # Authentication method configs
├── oauth2.toml # OAuth2 provider settings
├── jwt.toml # JWT method configuration
├── mfa.toml # Multi-factor authentication
└── api_key.toml # API key authentication
Parent Application Integration
Auth-framework configuration seamlessly integrates into larger application configs:
# your-app.toml
[]
= "MyApplication"
= "1.0.0"
# Include auth-framework configuration
[]
= ["auth-framework.toml"]
# Override specific auth settings
[]
= "production-secret"
= "myapp.com"
For complete configuration documentation, see:
config/INTEGRATION_GUIDE.md- Parent app integration patternsconfig/EXAMPLES.md- Practical configuration examplesconfig/directory - Example modular configuration files
Security Considerations
- Secret Management: Never hardcode secrets. Use environment variables or secure vaults.
- Token Storage: Use secure storage backends in production (PostgreSQL recommended, Redis for sessions).
- HTTPS: Always use HTTPS in production to protect tokens in transit.
- Rate Limiting: Enable rate limiting to prevent brute force attacks.
- Token Expiration: Set appropriate token lifetimes based on your security requirements.
- Audit Logging: Enable comprehensive audit logging for security monitoring.
RSA Key Format Support
When using RSA keys for JWT signing and verification, the framework supports both standard PEM formats:
Supported Formats
-
PKCS#1 Format (Traditional RSA format):
-----BEGIN RSA PRIVATE KEY----- -----END RSA PRIVATE KEY----- -
PKCS#8 Format (Modern standard format, recommended):
-----BEGIN PRIVATE KEY----- -----END PRIVATE KEY-----
Usage
Both formats are automatically detected and work seamlessly with the TokenManager:
use TokenManager;
// Load your RSA keys (either PKCS#1 or PKCS#8 format)
let private_key = read?;
let public_key = read?;
// Create token manager - format is auto-detected
let token_manager = new_rsa?;
Key Generation
Generate RSA keys in your preferred format:
# Generate PKCS#1 format (traditional)
# Generate PKCS#8 format (recommended)
Note: No format conversion is required - the framework handles both formats automatically.
📚 Examples
🔧 Client Examples (Ready to Use)
See the examples/ directory for complete client examples:
basic_usage_corrected.rs- Basic authentication setup (✅ working)cli_auth_tool.rs- Complete CLI authentication tool (✅ working)
🚀 Server Examples (NEW - Complete Authorization Server)
Full OAuth 2.0 Authorization Server Examples:
oauth2_authorization_server.rs- Complete OAuth 2.0 server setup with client registrationcomplete_oauth2_server_axum.rs- Axum server reference implementation with AuthFramework integrationproduction_deployments.rs- Enterprise deployment configurations for different environments
Server Features Demonstrated:
- ✅ OAuth 2.0 Authorization Server - Complete RFC 6749 implementation with all grant types
- ✅ OpenID Connect Provider - Full OIDC 1.0 support with UserInfo endpoint
- ✅ Dynamic Client Registration - RFC 7591 compliant client management
- ✅ Device Authorization Grant - RFC 8628 device flow for CLI applications
- ✅ Token Introspection - RFC 7662 token introspection endpoint
- ✅ PKCE Support - RFC 7636 for enhanced security
- ✅ Web Framework Integration - Ready-to-use Axum, Actix Web, and Warp examples
- ✅ Production Deployments - Enterprise, high-availability, and microservices configurations
🏢 Deployment Examples
Choose the deployment that fits your needs:
| Deployment Type | Use Case | Storage | Features |
|---|---|---|---|
| Development | Local testing | In-memory | Relaxed security, test clients |
| Single Server | Small-medium apps | PostgreSQL + Redis | Standard production features |
| High Availability | Large applications | PostgreSQL cluster + Redis | Load balancing, shared state |
| Enterprise | Fortune 500 | Encrypted storage + HSM | Advanced security, compliance |
| Microservices | Service mesh | Service discovery | Health checks, circuit breakers |
🚀 Quick Start Server
# Run a complete OAuth 2.0 authorization server
# Run with Axum web framework integration
# Run enterprise deployment
DEPLOYMENT_TYPE=enterprise
Note: Server examples are reference implementations. Review secrets management, storage, TLS, deployment topology, and compliance settings before treating an example as production-ready.
Contributing
Contributions are welcome! Please read our Contributing Guide for details on our development process, coding standards, and how to submit pull requests.
Security
Security is our top priority. Please review our Security Policy for:
- Reporting security vulnerabilities
- Security best practices
- Supported versions
- Compliance information
For security issues, please email ciresnave@gmail.com instead of using the issue tracker.
License
This project is licensed under the MIT OR Apache-2.0 license.
Testing Your Authentication Code
The framework provides comprehensive testing utilities to make testing your authentication logic easy:
[]
= { = "0.5.0-rc18", = ["testing"] }
use ;
async
async
async
Testing Features:
MockAuthMethod- Configurable mock authenticationMockStorage- In-memory storage for testinghelpers::create_test_*- Helper functions for test data- Configurable delays and failures for testing edge cases
- Comprehensive test coverage examples
Error Handling
The framework provides specific error types for better error handling:
use ;
async
Provider Configuration
OAuth providers are available for server-side implementations. See the server examples for complete provider usage:
use ;
use HashMap;
// Available providers for OAuth server implementations
let github_provider = GitHub;
let google_provider = Google;
let microsoft_provider = Microsoft;
// Custom provider configuration
let custom_provider = Custom ;
// For complete OAuth server implementation examples, see:
// - examples/oauth2_authorization_server.rs
// - examples/complete_oauth2_server_axum.rs
User Profile Standardization
The framework provides a standardized UserProfile type that works across all providers:
use UserProfile;
// Creating user profiles
let profile = new
.with_name
.with_email
.with_email_verified
.with_picture
.with_locale
.with_additional_data;
// Converting to your application's user type
// Usage
let app_user: AppUser = user_profile.into;
Credential Types Guide
Understanding the relationship between credentials and authentication methods:
use Credential;
// Password credentials -> PasswordMethod
let password_cred = password;
// API key -> ApiKeyMethod
let api_key_cred = api_key;
// JWT token -> JwtMethod
let jwt_cred = jwt;
// OAuth flows are handled by the OAuth server implementation
// See server examples for complete OAuth credential handling
let device_cred = Custom ;
// Multi-factor authentication
let mfa_cred = Mfa ;
// Custom credentials for custom auth methods
let custom_cred = Custom ;
CLI Integration
Helper utilities for integrating with CLI frameworks:
[]
= "0.5.0-rc18"
= "4.0"
= { = "1.0", = ["full"] }
use ;
use OAuthProvider;
use ;
async
async
async
AuthFramework includes protocol implementations for:
- PASETO (v4.local tokens)
- Macaroons (HMAC-SHA256 chained caveats)
- TACACS+ (RFC 8907 packet construction and obfuscation)
- SIWE (Sign-In with Ethereum, ERC-4361)
- IndieAuth (OAuth 2.0 with PKCE for IndieWeb)
- OAuth 1.0a (RFC 5849 request signing)
- FIDO1 / U2F (Universal 2nd Factor registration and authentication)
- UMA 2.0 (User-Managed Access)
- SAML 2.0 (Assertion builder and validator)
- SCIM 2.0 (Cross-domain identity management)
- CAS (Central Authentication Service)
- RADIUS (Remote Authentication Dial-In User Service)
- WS-Federation, WS-Security, WS-Trust
- ACME, SPIFFE, CAEP, OpenID4VCI, OpenID4VP, GNAP, Kerberos, HOTP