JwtDecoder

Trait JwtDecoder 

Source
pub trait JwtDecoder<T>: Send + Sync
where T: for<'de> DeserializeOwned,
{ // Required method fn decode<'a>( &'a self, token: &'a str, ) -> Pin<Box<dyn Future<Output = Result<TokenData<T>, Error>> + Send + 'a>>; }
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<'a>( &'a self, token: &'a str, ) -> Pin<Box<dyn Future<Output = Result<TokenData<T>, Error>> + Send + 'a>>

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,