Skip to main content

VerificationOptions

Struct VerificationOptions 

Source
pub struct VerificationOptions {
Show 14 fields pub reject_before: Option<UnixTimeStamp>, pub accept_future: bool, pub required_subject: Option<String>, pub required_key_id: Option<String>, pub required_signature_type: Option<String>, pub required_content_type: Option<String>, pub required_nonce: Option<String>, pub allowed_issuers: Option<HashSet<String>>, pub allowed_audiences: Option<HashSet<String>>, pub time_tolerance: Option<Duration>, pub max_validity: Option<Duration>, pub max_token_length: Option<usize>, pub max_header_length: Option<usize>, pub artificial_time: Option<UnixTimeStamp>,
}
Expand description

Additional features to enable during verification. Signatures and token expiration are already automatically verified.

Fields§

§reject_before: Option<UnixTimeStamp>

Reject tokens created before the given date.

For a given user, the time of the last successful authentication can be kept in a database, and reject_before can then be used to reject older (replayed) tokens.

Note: validation compares reject_before to the token’s issued_at claim. Tokens without issued_at are rejected when reject_before is set, so be sure the issuer populates it (automatically done by constructing claims with Claims::create()).

§accept_future: bool

Accept tokens created with a date in the future

§required_subject: Option<String>

Require a specific subject to be present

§required_key_id: Option<String>

Require a specific key identifier to be present

§required_signature_type: Option<String>

Require a specific signature type

§required_content_type: Option<String>

Require a specific content type

§required_nonce: Option<String>

Require a specific nonce to be present

§allowed_issuers: Option<HashSet<String>>

Require the issuer to be present in the set

§allowed_audiences: Option<HashSet<String>>

Require the audience to be present in the set

§time_tolerance: Option<Duration>

How much clock drift to tolerate when verifying token timestamps Default is 15 minutes, to work around common issues with clocks that are not perfectly accurate

§max_validity: Option<Duration>

Reject tokens created more than max_validity ago

§max_token_length: Option<usize>

Maximum token length to accept

§max_header_length: Option<usize>

Maximum unsafe, untrusted, unverified JWT header length to accept

§artificial_time: Option<UnixTimeStamp>

Change the current time. Only used for testing.

Trait Implementations§

Source§

impl Clone for VerificationOptions

Source§

fn clone(&self) -> VerificationOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VerificationOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VerificationOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for VerificationOptions

Source§

impl PartialEq for VerificationOptions

Source§

fn eq(&self, other: &VerificationOptions) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for VerificationOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V