pub struct JwtLayer<Claim, F = DecodingKey> { /* private fields */ }Expand description
Layer to validate JWT tokens with a decoding key. Valid claims are added to the request extension
It can also be used with tonic. See: https://github.com/hyperium/tonic/blob/master/examples/src/tower/server.rs
Implementations§
Source§impl<Claim, F: DecodingKeyFn> JwtLayer<Claim, F>
impl<Claim, F: DecodingKeyFn> JwtLayer<Claim, F>
Sourcepub fn new(validation: Validation, decoding_key_fn: F) -> Self
pub fn new(validation: Validation, decoding_key_fn: F) -> Self
Create a new layer to validate JWT tokens with the given decoding key Tokens will only be accepted if they pass the validation
Trait Implementations§
Auto Trait Implementations§
impl<Claim, F> Freeze for JwtLayer<Claim, F>where
F: Freeze,
impl<Claim, F> RefUnwindSafe for JwtLayer<Claim, F>where
F: RefUnwindSafe,
Claim: RefUnwindSafe,
impl<Claim, F> Send for JwtLayer<Claim, F>
impl<Claim, F> Sync for JwtLayer<Claim, F>
impl<Claim, F> Unpin for JwtLayer<Claim, F>
impl<Claim, F> UnwindSafe for JwtLayer<Claim, F>where
F: UnwindSafe,
Claim: UnwindSafe,
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