pub struct AuthMiddleware {
pub key: ServiceAccountKey,
/* private fields */
}Expand description
A middleware that handles OAuth2 authentication for Firebase requests.
This middleware intercepts outgoing requests, obtains a valid OAuth2 Bearer token
using the service account credentials, and injects it into the Authorization header.
§Lazy Initialization
The Authenticator is initialized lazily using tokio::sync::OnceCell upon the first request.
This allows the FirebaseApp constructor to remain synchronous.
Fields§
§key: ServiceAccountKeyThe service account key used to create the authenticator.
Implementations§
Source§impl AuthMiddleware
impl AuthMiddleware
Sourcepub fn new(key: ServiceAccountKey) -> Self
pub fn new(key: ServiceAccountKey) -> Self
Sourcepub fn with_tenant(&self, tenant_id: &str) -> Self
pub fn with_tenant(&self, tenant_id: &str) -> Self
Creates a new AuthMiddleware instance with a specific Tenant ID.
Trait Implementations§
Source§impl Clone for AuthMiddleware
impl Clone for AuthMiddleware
Source§fn clone(&self) -> AuthMiddleware
fn clone(&self) -> AuthMiddleware
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 moreSource§impl Middleware for AuthMiddleware
impl Middleware for AuthMiddleware
Source§fn handle<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: Request,
extensions: &'life1 mut Extensions,
next: Next<'life2>,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: Request,
extensions: &'life1 mut Extensions,
next: Next<'life2>,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Intercepts the request to add the Authorization header.
Auto Trait Implementations§
impl Freeze for AuthMiddleware
impl !RefUnwindSafe for AuthMiddleware
impl Send for AuthMiddleware
impl Sync for AuthMiddleware
impl Unpin for AuthMiddleware
impl !UnwindSafe for AuthMiddleware
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