Skip to main content

TokenSource

Trait TokenSource 

Source
pub trait TokenSource: Send + Sync {
    // Required method
    fn extract(&self, parts: &Parts) -> Option<String>;
}
Expand description

Trait for extracting JWT token strings from HTTP requests.

Middleware tries sources in order and uses the first Some(token). Implement this trait to support custom token locations.

Required Methods§

Source

fn extract(&self, parts: &Parts) -> Option<String>

Attempts to extract a token string from request parts. Returns None if this source does not find a token.

Implementors§