Skip to main content

crates_docs/server/auth/
mod.rs

1//! Authentication module
2//!
3//! Provides OAuth 2.0 and API Key authentication support.
4//!
5//! # Authentication Methods
6//!
7//! - **OAuth 2.0**: Full OAuth flow with GitHub, Google, Keycloak support
8//! - **API Key**: Simple API key authentication with secure hashing
9//!
10//! # Example
11//!
12//! ```rust,no_run
13//! use crates_docs::server::auth::{ApiKeyConfig, AuthConfig};
14//!
15//! // Create API Key configuration
16//! let api_key_config = ApiKeyConfig {
17//!     enabled: true,
18//!     keys: vec!["sk_live_xxx".to_string()],
19//!     header_name: "X-API-Key".to_string(),
20//!     ..Default::default()
21//! };
22//! ```
23
24mod config;
25mod manager;
26mod token;
27mod types;
28
29#[cfg(all(feature = "api-key", feature = "auth"))]
30mod api_key_provider;
31
32#[cfg(test)]
33mod tests;
34
35#[cfg(all(feature = "api-key", feature = "auth"))]
36pub use api_key_provider::ApiKeyAuthProvider;
37#[cfg(feature = "api-key")]
38pub use config::ApiKeyConfig;
39pub use config::{AuthConfig, OAuthConfig};
40pub use manager::AuthManager;
41pub use token::{TokenInfo, TokenStore, TokenStoreError, TokenStoreResult};
42#[cfg(feature = "api-key")]
43pub use types::GeneratedApiKey;
44pub use types::{AuthContext, AuthProvider, OAuthProvider};