WsTokenExtractor

Trait WsTokenExtractor 

Source
pub trait WsTokenExtractor: Send + Sync {
    // Required method
    fn extract_token<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        headers: &'life1 HashMap<String, String>,
        query: &'life2 HashMap<String, String>,
    ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Token extractor trait for WebSocket connections WebSocket 连接的 Token 提取器 trait

Implement this trait to customize token extraction logic 实现此 trait 以自定义 Token 提取逻辑

Required Methods§

Source

fn extract_token<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, headers: &'life1 HashMap<String, String>, query: &'life2 HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Extract token from headers and query parameters 从请求头和查询参数中提取 Token

§Arguments | 参数
  • headers - HTTP headers | HTTP 请求头
  • query - Query parameters | 查询参数
§Returns | 返回值
  • Some(token) - Token found | 找到 Token
  • None - No token found | 未找到 Token

Implementors§