pub struct OidcAuthenticationLayer<C, T> { /* private fields */ }Expand description
A layer that provides OIDC authentication for Axum services.
It extracts the Bearer token from the request headers, validates it against
the OIDC provider’s JWKS, and injects the decoded claims into the request
extensions.
This layer is generic over the configuration type C and the type of claims T.
The configuration type must implement AuthenticationConfigProvider, and the
claims type T must implement DeserializeOwned.
Implementations§
Source§impl<C, T> OidcAuthenticationLayer<C, T>
impl<C, T> OidcAuthenticationLayer<C, T>
Sourcepub fn new(config: C) -> Self
pub fn new(config: C) -> Self
Creates a new OidcAuthenticationLayer with the given configuration and a default in-memory cache.
Sourcepub fn with_cache(config: C, cache: Arc<dyn JwksCache>) -> Self
pub fn with_cache(config: C, cache: Arc<dyn JwksCache>) -> Self
Creates a new OidcAuthenticationLayer with the given configuration and custom cache implementation.
Trait Implementations§
Source§impl<C: Clone, T: Clone> Clone for OidcAuthenticationLayer<C, T>
impl<C: Clone, T: Clone> Clone for OidcAuthenticationLayer<C, T>
Source§fn clone(&self) -> OidcAuthenticationLayer<C, T>
fn clone(&self) -> OidcAuthenticationLayer<C, T>
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<S, C, T> Layer<S> for OidcAuthenticationLayer<C, T>
impl<S, C, T> Layer<S> for OidcAuthenticationLayer<C, T>
Auto Trait Implementations§
impl<C, T> Freeze for OidcAuthenticationLayer<C, T>where
C: Freeze,
impl<C, T> !RefUnwindSafe for OidcAuthenticationLayer<C, T>
impl<C, T> Send for OidcAuthenticationLayer<C, T>
impl<C, T> Sync for OidcAuthenticationLayer<C, T>
impl<C, T> Unpin for OidcAuthenticationLayer<C, T>
impl<C, T> !UnwindSafe for OidcAuthenticationLayer<C, T>
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