TokenStorage

Trait TokenStorage 

Source
pub trait TokenStorage:
    Send
    + Sync
    + Debug {
    // Required methods
    fn store_access_token<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
        token: &'life2 AccessToken,
    ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_access_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = McpResult<Option<AccessToken>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn store_refresh_token<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
        token: &'life2 RefreshToken,
    ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_refresh_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = McpResult<Option<RefreshToken>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn revoke_tokens<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_users<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = McpResult<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Secure token storage abstraction

Required Methods§

Source

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

Store access token securely

Source

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

Retrieve access token

Source

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

Store refresh token securely (encrypted at rest)

Source

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

Retrieve refresh token

Source

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

Remove all tokens for user (logout)

Source

fn list_users<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = McpResult<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all users with stored tokens (for admin)

Implementors§