Crate avl_auth

Crate avl_auth 

Source
Expand description

§AVL Auth - World-Class Identity and Access Management

The most advanced authentication and authorization system, built for AVL Cloud Platform with native AvilaDB integration.

§Features

  • JWT Authentication: Multi-algorithm support with automatic key rotation
  • OAuth2/OIDC: Complete flows for Google, GitHub, Microsoft, Apple
  • MFA: TOTP, WebAuthn/FIDO2, biometric authentication
  • RBAC + ABAC: Dynamic role and attribute-based access control
  • API Keys: Scoped keys with rate limiting and auto-rotation
  • Zero Trust: Continuous authentication and risk-based access
  • Anomaly Detection: ML-powered threat detection
  • Audit Trail: Complete LGPD/GDPR compliant logging
  • Session Management: Distributed sessions with AvilaDB
  • Password Security: Argon2id with configurable cost parameters

§Quick Start

use avl_auth::{AuthClient, Credentials, Config};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = Config::default();
    let auth = AuthClient::new(config).await?;

    // Register with strong password policy
    let user_id = auth.register("user@example.com", "SecureP@ss123").await?;

    // Login with device fingerprinting
    let session = auth.login(Credentials {
        email: "user@example.com".to_string(),
        password: "SecureP@ss123".to_string(),
        device_id: Some("device_123".to_string()),
        ip_address: Some("192.168.1.1".parse()?),
    }).await?;

    // Verify token with automatic refresh
    let claims = auth.verify_token(&session.access_token).await?;
    println!("User: {}", claims.sub);

    Ok(())
}

Re-exports§

pub use client::AuthClient;
pub use config::Config;
pub use error::AuthError;
pub use error::Result;
pub use models::*;

Modules§

api_keys
API Key management with scopes and rate limiting
audit
Comprehensive audit logging system
client
Main AuthClient implementation
config
Configuration for AVL Auth
crypto
Cryptographic utilities and key management
error
Error types for AVL Auth
jwt
Advanced JWT implementation with key rotation and multi-algorithm support
mfa
Multi-factor authentication with TOTP and WebAuthn
models
Data models for AVL Auth
oauth2
OAuth2 and OpenID Connect implementation
password
Password hashing and validation with Argon2id
permissions
Role-Based and Attribute-Based Access Control
prelude
Prelude with commonly used types
risk
Risk-based authentication and anomaly detection
session
Session management with distributed storage

Constants§

VERSION
AVL Auth version