Struct aliri::jwt::CoreValidator
source · pub struct CoreValidator { /* private fields */ }
Expand description
A core validator for JWTs
A default validator configured with common expected validations.
Implementations§
source§impl CoreValidator
impl CoreValidator
sourcepub fn with_leeway(self, leeway: Duration) -> Self
pub fn with_leeway(self, leeway: Duration) -> Self
Allows a grace period for token validation
Applies on either side of the “not before” and “expires” claims.
sourcepub fn with_leeway_secs(self, leeway: u64) -> Self
pub fn with_leeway_secs(self, leeway: u64) -> Self
Allows a grace period (in seconds) for token validation
Applies on either side of the “not before” and “expires” claims.
sourcepub fn check_expiration(self) -> Self
pub fn check_expiration(self) -> Self
Enforces expiration checks
sourcepub fn check_not_before(self) -> Self
pub fn check_not_before(self) -> Self
Enforces “not valid before” checks
sourcepub fn ignore_expiration(self) -> Self
pub fn ignore_expiration(self) -> Self
Skips expiration checks
sourcepub fn ignore_not_before(self) -> Self
pub fn ignore_not_before(self) -> Self
Skips “not valid before” checks
sourcepub fn add_allowed_audience(self, audience: Audience) -> Self
pub fn add_allowed_audience(self, audience: Audience) -> Self
Adds a single audience to the set of allowed audiences
sourcepub fn extend_allowed_audiences<I: IntoIterator<Item = Audience>>(
self,
alg: I
) -> Self
pub fn extend_allowed_audiences<I: IntoIterator<Item = Audience>>( self, alg: I ) -> Self
Adds multiple audiences to the set of allowed audiences
sourcepub fn add_approved_algorithm(self, alg: Algorithm) -> Self
pub fn add_approved_algorithm(self, alg: Algorithm) -> Self
Approves a single algorithm
sourcepub fn extend_approved_algorithms<I: IntoIterator<Item = Algorithm>>(
self,
alg: I
) -> Self
pub fn extend_approved_algorithms<I: IntoIterator<Item = Algorithm>>( self, alg: I ) -> Self
Approves multiple algorithms
sourcepub fn require_issuer(self, issuer: Issuer) -> Self
pub fn require_issuer(self, issuer: Issuer) -> Self
Require that tokens specify a particular issuer
sourcepub fn check_subject(self, sub_regex: Regex) -> Self
pub fn check_subject(self, sub_regex: Regex) -> Self
Require that the sub
claim exists and matches a particular
regular expression
Trait Implementations§
source§impl Clone for CoreValidator
impl Clone for CoreValidator
source§fn clone(&self) -> CoreValidator
fn clone(&self) -> CoreValidator
Returns a copy 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 CoreValidator
impl Debug for CoreValidator
Auto Trait Implementations§
impl Freeze for CoreValidator
impl RefUnwindSafe for CoreValidator
impl Send for CoreValidator
impl Sync for CoreValidator
impl Unpin for CoreValidator
impl UnwindSafe for CoreValidator
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