pub struct MultiKeyVerifier<C> { /* private fields */ }Expand description
Multi-algorithm verifier with per-kid rotation.
keys carries algorithm-keyed defaults; keys_by_kid adds an optional
kid-keyed lookup that wins when the JWT header carries kid. Updating
the kid map at runtime rotates without restarting.
Implementations§
Source§impl<C> MultiKeyVerifier<C>
impl<C> MultiKeyVerifier<C>
Sourcepub fn new(
keys: HashMap<&'static str, AnyVerifyKey, RandomState>,
) -> MultiKeyVerifier<C>
pub fn new( keys: HashMap<&'static str, AnyVerifyKey, RandomState>, ) -> MultiKeyVerifier<C>
Builds a verifier with algorithm-only key selection.
Sourcepub fn rotate_key(&self, kid: impl Into<String>, key: AnyVerifyKey)
pub fn rotate_key(&self, kid: impl Into<String>, key: AnyVerifyKey)
Adds / replaces the rotation key for kid.
Sourcepub fn revoke_kid(&self, kid: &str)
pub fn revoke_kid(&self, kid: &str)
Removes the rotation key for kid.
Sourcepub fn constraints(self, c: VerifyConstraints) -> MultiKeyVerifier<C>
pub fn constraints(self, c: VerifyConstraints) -> MultiKeyVerifier<C>
Sets per-claim verification constraints.
Trait Implementations§
Source§impl<C> Clone for MultiKeyVerifier<C>
impl<C> Clone for MultiKeyVerifier<C>
Source§fn clone(&self) -> MultiKeyVerifier<C>
fn clone(&self) -> MultiKeyVerifier<C>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<C> JwtVerifier for MultiKeyVerifier<C>
impl<C> JwtVerifier for MultiKeyVerifier<C>
Source§fn verify(
&self,
token: &str,
) -> Result<<MultiKeyVerifier<C> as JwtVerifier>::Claims, <MultiKeyVerifier<C> as JwtVerifier>::Error>
fn verify( &self, token: &str, ) -> Result<<MultiKeyVerifier<C> as JwtVerifier>::Claims, <MultiKeyVerifier<C> as JwtVerifier>::Error>
Verifies a raw JWT token string.
Source§fn validate_constraints(
&self,
claims: &<MultiKeyVerifier<C> as JwtVerifier>::Claims,
constraints: &VerifyConstraints,
) -> Result<(), ConstraintsNotSupported>
fn validate_constraints( &self, claims: &<MultiKeyVerifier<C> as JwtVerifier>::Claims, constraints: &VerifyConstraints, ) -> Result<(), ConstraintsNotSupported>
Auto Trait Implementations§
impl<C> !RefUnwindSafe for MultiKeyVerifier<C>
impl<C> !UnwindSafe for MultiKeyVerifier<C>
impl<C> Freeze for MultiKeyVerifier<C>
impl<C> Send for MultiKeyVerifier<C>where
C: Send,
impl<C> Sync for MultiKeyVerifier<C>where
C: Sync,
impl<C> Unpin for MultiKeyVerifier<C>where
C: Unpin,
impl<C> UnsafeUnpin for MultiKeyVerifier<C>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more