JwtDecoder

Trait JwtDecoder 

Source
pub trait JwtDecoder<T>
where T: for<'de> DeserializeOwned,
{ // Required method fn decode<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<TokenData<T>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; }
Expand description

Trait for decoding and validating JWT tokens.

Implemented by LocalDecoder and RemoteJwksDecoder to provide a unified interface for JWT validation with different key sources.

Required Methods§

Source

fn decode<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<TokenData<T>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Decodes and validates a JWT token string, returning the parsed claims.

§Errors

Returns an error if the token is invalid, expired, has an invalid signature, or if the key cannot be found (for remote decoders).

Implementors§

Source§

impl<T> JwtDecoder<T> for LocalDecoder
where T: for<'de> DeserializeOwned,

Source§

impl<T> JwtDecoder<T> for RemoteJwksDecoder
where T: for<'de> DeserializeOwned,