AuthProvider

Trait AuthProvider 

Source
pub trait AuthProvider:
    Send
    + Sync
    + Debug {
    // Required methods
    fn name(&self) -> &str;
    fn provider_type(&self) -> AuthProviderType;
    fn authenticate<'life0, 'async_trait>(
        &'life0 self,
        credentials: AuthCredentials,
    ) -> Pin<Box<dyn Future<Output = McpResult<AuthContext>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn validate_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        token: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = McpResult<AuthContext>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn refresh_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        refresh_token: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = McpResult<TokenInfo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn revoke_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        token: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_user_info<'life0, 'life1, 'async_trait>(
        &'life0 self,
        token: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = McpResult<UserInfo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Authentication provider trait

Required Methods§

Source

fn name(&self) -> &str

Provider name

Source

fn provider_type(&self) -> AuthProviderType

Provider type

Source

fn authenticate<'life0, 'async_trait>( &'life0 self, credentials: AuthCredentials, ) -> Pin<Box<dyn Future<Output = McpResult<AuthContext>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Authenticate user with credentials

Source

fn validate_token<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = McpResult<AuthContext>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Validate existing token/session

Source

fn refresh_token<'life0, 'life1, 'async_trait>( &'life0 self, refresh_token: &'life1 str, ) -> Pin<Box<dyn Future<Output = McpResult<TokenInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Refresh access token

Source

fn revoke_token<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Revoke token/session

Source

fn get_user_info<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = McpResult<UserInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get user information

Implementors§