pub struct VerifierBuilder { /* private fields */ }
Expand description

Configures the requirements for checking token claims with a builder-pattern API

Implementations§

Examples found in repository?
src/verifier.rs (line 106)
105
106
107
    pub fn create() -> VerifierBuilder {
        VerifierBuilder::new()
    }

Convenience for string_equals(“iss”, “value”)

Convenience for string_or_array_contains(“aud”, “value”)

Convenience for string_equals(“sub”, “value”)

Convenience for string_equals(“nonce”, “value”)

Check that a claim has a specific string value

Examples found in repository?
src/verifier.rs (line 421)
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
    pub fn issuer(&mut self, issuer: impl Into<String>) -> &mut Self {
        self.string_equals("iss", issuer)
    }

    /// Convenience for string_or_array_contains("aud", "value")
    pub fn audience(&mut self, aud: impl Into<String>) -> &mut Self {
        self.string_or_array_contains("aud", aud)
    }

    /// Convenience for string_equals("sub", "value")
    pub fn subject(&mut self, sub: impl Into<String>) -> &mut Self {
        self.string_equals("sub", sub)
    }

    /// Convenience for string_equals("nonce", "value")
    pub fn nonce(&mut self, nonce: impl Into<String>) -> &mut Self {
        self.string_equals("nonce", nonce)
    }

Check that a claim equals one of the given string values

Check that the claim matches the given regular expression

Check that the claim matches one of the given regular expressions

Examples found in repository?
src/verifier.rs (line 426)
425
426
427
    pub fn audience(&mut self, aud: impl Into<String>) -> &mut Self {
        self.string_or_array_contains("aud", aud)
    }

Sets a leeway (in seconds) should be allowed when checking exp, nbf and iat claims

Don’t check the ‘exp’ expiry claim

Don’t check the ‘nbf’ not before claim

Don’t check the ‘iat’ issued at claim

Check a claim Value manually, returning true if ok, else false

Build the final Verifier

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.