Struct jsonwebtokens::VerifierBuilder
source · pub struct VerifierBuilder { /* private fields */ }
Expand description
Configures the requirements for checking token claims with a builder-pattern API
Implementations§
source§impl VerifierBuilder
impl VerifierBuilder
sourcepub fn issuer(&mut self, issuer: impl Into<String>) -> &mut Self
pub fn issuer(&mut self, issuer: impl Into<String>) -> &mut Self
Convenience for string_equals(“iss”, “value”)
sourcepub fn audience(&mut self, aud: impl Into<String>) -> &mut Self
pub fn audience(&mut self, aud: impl Into<String>) -> &mut Self
Convenience for string_or_array_contains(“aud”, “value”)
sourcepub fn subject(&mut self, sub: impl Into<String>) -> &mut Self
pub fn subject(&mut self, sub: impl Into<String>) -> &mut Self
Convenience for string_equals(“sub”, “value”)
sourcepub fn nonce(&mut self, nonce: impl Into<String>) -> &mut Self
pub fn nonce(&mut self, nonce: impl Into<String>) -> &mut Self
Convenience for string_equals(“nonce”, “value”)
sourcepub fn string_equals(
&mut self,
claim: impl Into<String>,
value: impl Into<String>
) -> &mut Self
pub fn string_equals(
&mut self,
claim: impl Into<String>,
value: impl Into<String>
) -> &mut Self
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)
}
sourcepub fn string_equals_one_of(
&mut self,
claim: impl Into<String>,
values: &[&str]
) -> &mut Self
pub fn string_equals_one_of(
&mut self,
claim: impl Into<String>,
values: &[&str]
) -> &mut Self
Check that a claim equals one of the given string values
sourcepub fn string_matches(
&mut self,
claim: impl Into<String>,
value: impl Into<Regex>
) -> &mut Self
pub fn string_matches(
&mut self,
claim: impl Into<String>,
value: impl Into<Regex>
) -> &mut Self
Check that the claim matches the given regular expression
sourcepub fn string_matches_one_of(
&mut self,
claim: impl Into<String>,
values: &[Regex]
) -> &mut Self
pub fn string_matches_one_of(
&mut self,
claim: impl Into<String>,
values: &[Regex]
) -> &mut Self
Check that the claim matches one of the given regular expressions
sourcepub fn string_or_array_contains(
&mut self,
claim: impl Into<String>,
value: impl Into<String>
) -> &mut Self
pub fn string_or_array_contains(
&mut self,
claim: impl Into<String>,
value: impl Into<String>
) -> &mut Self
sourcepub fn leeway(&mut self, leeway: u32) -> &mut Self
pub fn leeway(&mut self, leeway: u32) -> &mut Self
Sets a leeway (in seconds) should be allowed when checking exp, nbf and iat claims
sourcepub fn ignore_exp(&mut self) -> &mut Self
pub fn ignore_exp(&mut self) -> &mut Self
Don’t check the ‘exp’ expiry claim
sourcepub fn ignore_nbf(&mut self) -> &mut Self
pub fn ignore_nbf(&mut self) -> &mut Self
Don’t check the ‘nbf’ not before claim
sourcepub fn ignore_iat(&mut self) -> &mut Self
pub fn ignore_iat(&mut self) -> &mut Self
Don’t check the ‘iat’ issued at claim
Trait Implementations§
source§impl Debug for VerifierBuilder
impl Debug for VerifierBuilder
source§impl Default for VerifierBuilder
impl Default for VerifierBuilder
source§fn default() -> VerifierBuilder
fn default() -> VerifierBuilder
Returns the “default value” for a type. Read more