Skip to main content

TokenValidator

Trait TokenValidator 

Source
pub trait TokenValidator:
    Send
    + Sync
    + 'static {
    // Required method
    fn validate(
        &self,
        token: &str,
        config: &AuthConfig,
    ) -> Pin<Box<dyn Future<Output = Result<AuthenticatedUser, AuthError>> + Send + '_>>;
}
Expand description

Trait for validating tokens and extracting user identity.

Implement this for each identity provider (Google, Auth0, etc.). The middleware calls validate() with the bearer token and returns the authenticated user on success.

Required Methods§

Source

fn validate( &self, token: &str, config: &AuthConfig, ) -> Pin<Box<dyn Future<Output = Result<AuthenticatedUser, AuthError>> + Send + '_>>

Validate a token and return the authenticated user.

Implementors§