pub struct AuthenticationHandler { /* private fields */ }Expand description
Main authentication handler
Implementations§
Source§impl AuthenticationHandler
impl AuthenticationHandler
Sourcepub fn new(config: AuthConfig) -> Self
pub fn new(config: AuthConfig) -> Self
Create a new authentication handler
Sourcepub fn builder() -> AuthenticationHandlerBuilder
pub fn builder() -> AuthenticationHandlerBuilder
Create a builder for the handler
Sourcepub async fn authenticate(
&self,
request: &AuthRequest,
) -> Result<AuthResult, AuthError>
pub async fn authenticate( &self, request: &AuthRequest, ) -> Result<AuthResult, AuthError>
Authenticate a request
Sourcepub fn register_api_key(
&self,
key_id: String,
key_value: String,
identity: Identity,
expires_at: Option<DateTime<Utc>>,
scopes: Vec<String>,
)
pub fn register_api_key( &self, key_id: String, key_value: String, identity: Identity, expires_at: Option<DateTime<Utc>>, scopes: Vec<String>, )
Register an API key
Sourcepub fn revoke_api_key(&self, key_id: &str) -> bool
pub fn revoke_api_key(&self, key_id: &str) -> bool
Revoke an API key
Sourcepub async fn refresh_jwks_if_needed(&self) -> Result<(), AuthError>
pub async fn refresh_jwks_if_needed(&self) -> Result<(), AuthError>
Refresh JWKS if needed
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear authentication cache
Sourcepub fn cache_stats(&self) -> CacheStats
pub fn cache_stats(&self) -> CacheStats
Get cache statistics
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if authentication is enabled
Auto Trait Implementations§
impl Freeze for AuthenticationHandler
impl !RefUnwindSafe for AuthenticationHandler
impl Send for AuthenticationHandler
impl Sync for AuthenticationHandler
impl Unpin for AuthenticationHandler
impl UnsafeUnpin for AuthenticationHandler
impl !UnwindSafe for AuthenticationHandler
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more