pub struct OidcValidator { /* private fields */ }Expand description
JWKS-backed OIDC token validator.
Caches JWKS keys with a 24-hour TTL. Rejects HMAC algorithms (only accepts asymmetric: RS256, ES256, etc.).
Implementations§
Source§impl OidcValidator
impl OidcValidator
Sourcepub fn new(config: OidcValidatorConfig) -> Self
pub fn new(config: OidcValidatorConfig) -> Self
Create a new validator. Call refresh_jwks() after construction.
Sourcepub fn config(&self) -> &OidcValidatorConfig
pub fn config(&self) -> &OidcValidatorConfig
Get the validator configuration.
Sourcepub async fn validate_token<T: DeserializeOwned>(
&self,
token: &str,
) -> Result<T, OidcError>
pub async fn validate_token<T: DeserializeOwned>( &self, token: &str, ) -> Result<T, OidcError>
Validate a JWT and extract typed claims.
Sourcepub async fn refresh_jwks(&self) -> Result<(), OidcError>
pub async fn refresh_jwks(&self) -> Result<(), OidcError>
Force-refresh the JWKS cache.
Auto Trait Implementations§
impl !RefUnwindSafe for OidcValidator
impl !UnwindSafe for OidcValidator
impl Freeze for OidcValidator
impl Send for OidcValidator
impl Sync for OidcValidator
impl Unpin for OidcValidator
impl UnsafeUnpin for OidcValidator
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