pub struct FirebaseConfig {
pub project_id: String,
pub key_cache: PublicKeyCache,
pub max_token_age: Duration,
pub allowed_algorithms: Vec<Algorithm>,
}Expand description
Firebase authentication configuration.
Contains all settings needed for JWT validation including project ID, key cache configuration, and security parameters.
Fields§
§project_id: StringFirebase project ID
key_cache: PublicKeyCachePublic key cache instance
max_token_age: DurationMaximum allowed token age
allowed_algorithms: Vec<Algorithm>Allowed JWT algorithms (defaults to RS256 only)
Implementations§
Source§impl FirebaseConfig
impl FirebaseConfig
Sourcepub fn new(project_id: String) -> Result<Self, FirebaseAuthError>
pub fn new(project_id: String) -> Result<Self, FirebaseAuthError>
Creates a new Firebase configuration with secure defaults.
§Arguments
project_id- Your Firebase project ID
§Errors
Returns FirebaseAuthError::ConfigError for invalid project IDs or setup failures.
§Example
use axum_firebase_middleware::FirebaseConfig;
let config = FirebaseConfig::new("my-firebase-project".to_string())?;Sourcepub fn with_cache_duration(
self,
seconds: u64,
) -> Result<Self, FirebaseAuthError>
pub fn with_cache_duration( self, seconds: u64, ) -> Result<Self, FirebaseAuthError>
Sourcepub fn with_max_token_age(self, duration: Duration) -> Self
pub fn with_max_token_age(self, duration: Duration) -> Self
Sets the maximum allowed token age.
Tokens older than this duration will be rejected even if not expired.
§Arguments
duration- Maximum token age
Trait Implementations§
Source§impl Clone for FirebaseConfig
impl Clone for FirebaseConfig
Source§fn clone(&self) -> FirebaseConfig
fn clone(&self) -> FirebaseConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FirebaseConfig
impl !RefUnwindSafe for FirebaseConfig
impl Send for FirebaseConfig
impl Sync for FirebaseConfig
impl Unpin for FirebaseConfig
impl !UnwindSafe for FirebaseConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more