#[non_exhaustive]pub struct ValidationConfig {
pub leeway: Duration,
pub require_issuer: Option<String>,
pub require_audience: Option<String>,
}Expand description
Policy-level validation rules applied to every decode() call.
exp is always enforced (not configurable). These fields control
additional checks for iss, aud, and clock skew tolerance.
Built automatically from JwtSessionsConfig by
JwtEncoder::from_config() and JwtDecoder::from_config().
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.leeway: DurationAllowed clock skew applied to exp and nbf checks.
Defaults to Duration::ZERO.
require_issuer: Option<String>When Some, decode() rejects tokens whose iss does not match.
require_audience: Option<String>When Some, decode() rejects tokens whose aud does not match.
Implementations§
Source§impl ValidationConfig
impl ValidationConfig
Sourcepub fn with_audience(self, aud: impl Into<String>) -> Self
pub fn with_audience(self, aud: impl Into<String>) -> Self
Sourcepub fn with_issuer(self, iss: impl Into<String>) -> Self
pub fn with_issuer(self, iss: impl Into<String>) -> Self
Require that decoded tokens carry a specific iss claim.
Returns a new ValidationConfig with require_issuer set. All other
fields are unchanged.
Trait Implementations§
Source§impl Clone for ValidationConfig
impl Clone for ValidationConfig
Source§fn clone(&self) -> ValidationConfig
fn clone(&self) -> ValidationConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ValidationConfig
impl Debug for ValidationConfig
Auto Trait Implementations§
impl Freeze for ValidationConfig
impl RefUnwindSafe for ValidationConfig
impl Send for ValidationConfig
impl Sync for ValidationConfig
impl Unpin for ValidationConfig
impl UnsafeUnpin for ValidationConfig
impl UnwindSafe for ValidationConfig
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