pub struct OidcValidator { /* private fields */ }Expand description
Locally validates RS256 tokens issued by one trusted OIDC issuer.
See the module docs for the resolution model, caching policy, and interchangeability bar. Construction:
OidcValidator::with_fetcher— inject anyJwksFetcher(tests, custom HTTP stacks).OidcValidator::new— batteries-includedreqwestfetcher; requires theoidc-reqwestfeature.
The validator is Send + Sync; share one instance per backend (the
JWKS cache lives inside it).
Implementations§
Source§impl OidcValidator
impl OidcValidator
Sourcepub fn with_fetcher(config: OidcConfig, fetcher: Arc<dyn JwksFetcher>) -> Self
pub fn with_fetcher(config: OidcConfig, fetcher: Arc<dyn JwksFetcher>) -> Self
Build a validator over an injected fetcher.
Sourcepub fn config(&self) -> &OidcConfig
pub fn config(&self) -> &OidcConfig
The validator’s configuration.
Sourcepub async fn validate_token(
&self,
token: &str,
) -> Result<VerifiedToken, OidcError>
pub async fn validate_token( &self, token: &str, ) -> Result<VerifiedToken, OidcError>
Validate a token end-to-end and mint the sealed proof.
Steps: header gate (alg == RS256, kid present) → cache
freshness (refresh on cold/expired TTL; degrade to stale keys if
the IdP is unreachable and a cache exists) → kid lookup (miss →
one refresh — at most one a minute per validator — then reject) → RS256 signature
iss/aud/expwith zero leeway →iatnot in the future →org_id→TenantId→VerifiedUserminted.
Auto Trait Implementations§
impl !Freeze for OidcValidator
impl !RefUnwindSafe for OidcValidator
impl !UnwindSafe for OidcValidator
impl Forget for OidcValidator
impl Move 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