Skip to main content

Module auth

Module auth 

Source
Expand description

Authentication module

Provides OAuth 2.0 and API Key authentication support.

§Authentication Methods

  • OAuth 2.0: Full OAuth flow with GitHub, Google, Keycloak support
  • API Key: Simple API key authentication with secure hashing

§Example

use crates_docs::server::auth::{ApiKeyConfig, AuthConfig};

// Create API Key configuration
let api_key_config = ApiKeyConfig {
    enabled: true,
    keys: vec!["sk_live_xxx".to_string()],
    header_name: "X-API-Key".to_string(),
    ..Default::default()
};

Structs§

ApiKeyConfig
API Key configuration
AuthConfig
Authentication configuration (unified for OAuth and API Key)
AuthContext
Authentication context
AuthManager
Authentication manager
GeneratedApiKey
API Key generation result.
OAuthConfig
OAuth configuration
TokenInfo
OAuth token information
TokenStore
Simple in-memory token store (production should use Redis or database)

Enums§

AuthProvider
Authentication provider type
OAuthProvider
OAuth provider type