pub struct AsyncVerifier { /* private fields */ }Expand description
Async verifier with JWKS caching support
Implementations§
Source§impl AsyncVerifier
impl AsyncVerifier
Sourcepub fn with_static_key(
key: VerifyingKey,
issuer: impl Into<String>,
audience: impl Into<String>,
) -> AsyncVerifier
pub fn with_static_key( key: VerifyingKey, issuer: impl Into<String>, audience: impl Into<String>, ) -> AsyncVerifier
Create a verifier with a static key
Sourcepub fn with_jwks(
jwks: Jwks,
issuer: impl Into<String>,
audience: impl Into<String>,
) -> AsyncVerifier
pub fn with_jwks( jwks: Jwks, issuer: impl Into<String>, audience: impl Into<String>, ) -> AsyncVerifier
Create a verifier with JWKS
Sourcepub fn with_jwks_url(
url: impl Into<String>,
issuer: impl Into<String>,
audience: impl Into<String>,
) -> AsyncVerifier
pub fn with_jwks_url( url: impl Into<String>, issuer: impl Into<String>, audience: impl Into<String>, ) -> AsyncVerifier
Create a verifier that fetches JWKS from a URL
Sourcepub fn with_origin_validation(self) -> AsyncVerifier
pub fn with_origin_validation(self) -> AsyncVerifier
Require origin validation on verified tokens.
Sourcepub fn with_cache_duration(self, duration: Duration) -> AsyncVerifier
pub fn with_cache_duration(self, duration: Duration) -> AsyncVerifier
Set cache duration for JWKS
Sourcepub async fn verify(
&self,
token: &str,
expected_origin: Option<&str>,
expected_client_ip: Option<&str>,
) -> Result<AuthContext, VerifyError>
pub async fn verify( &self, token: &str, expected_origin: Option<&str>, expected_client_ip: Option<&str>, ) -> Result<AuthContext, VerifyError>
Verify a token with automatic JWKS fetching and caching
Sourcepub async fn refresh_cache(&self) -> Result<(), VerifyError>
pub async fn refresh_cache(&self) -> Result<(), VerifyError>
Refresh JWKS cache from the configured URL
Sourcepub async fn verify_with_cache(
&self,
token: &str,
expected_origin: Option<&str>,
expected_client_ip: Option<&str>,
) -> Result<AuthContext, VerifyError>
pub async fn verify_with_cache( &self, token: &str, expected_origin: Option<&str>, expected_client_ip: Option<&str>, ) -> Result<AuthContext, VerifyError>
Verify a token with automatic JWKS caching
Auto Trait Implementations§
impl Freeze for AsyncVerifier
impl !RefUnwindSafe for AsyncVerifier
impl Send for AsyncVerifier
impl Sync for AsyncVerifier
impl Unpin for AsyncVerifier
impl UnsafeUnpin for AsyncVerifier
impl !UnwindSafe for AsyncVerifier
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