pub struct TokenValidator { /* private fields */ }Expand description
Token validator with JWKS support
Implementations§
Source§impl TokenValidator
impl TokenValidator
Sourcepub fn with_jwks_uri(issuer: &str, audience: &str, jwks_uri: &str) -> Self
pub fn with_jwks_uri(issuer: &str, audience: &str, jwks_uri: &str) -> Self
Create a new token validator with JWKS URI for signature verification
Sourcepub fn with_clock_skew(self, seconds: i64) -> Self
pub fn with_clock_skew(self, seconds: i64) -> Self
Set clock skew tolerance
Sourcepub fn validate_claims(
&self,
claims: &IdTokenClaims,
expected_nonce: Option<&str>,
) -> Result<()>
pub fn validate_claims( &self, claims: &IdTokenClaims, expected_nonce: Option<&str>, ) -> Result<()>
Validate ID token claims (without cryptographic verification)
Note: For production, you should also verify the JWT signature using the provider’s JWKS.
Sourcepub async fn decode_and_verify_jwt(&self, token: &str) -> Result<IdTokenClaims>
pub async fn decode_and_verify_jwt(&self, token: &str) -> Result<IdTokenClaims>
Decode and verify JWT token with signature verification
This method verifies the JWT signature using JWKS before trusting the claims.
Sourcepub fn decode_jwt_claims(&self, token: &str) -> Result<IdTokenClaims>
pub fn decode_jwt_claims(&self, token: &str) -> Result<IdTokenClaims>
Decode JWT without verification (for extracting claims)
NOTE: This does not verify the signature. Use decode_and_verify_jwt() for production.
Auto Trait Implementations§
impl Freeze for TokenValidator
impl !RefUnwindSafe for TokenValidator
impl Send for TokenValidator
impl Sync for TokenValidator
impl Unpin for TokenValidator
impl UnsafeUnpin for TokenValidator
impl !UnwindSafe for TokenValidator
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