Skip to main content

UserConnectionResolver

Trait UserConnectionResolver 

Source
pub trait UserConnectionResolver: Send + Sync {
    // Required method
    fn get_connection_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: SessionId,
        provider: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn get_connection_user<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _session_id: SessionId,
        _provider: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Uuid>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn get_connection_token_for_user<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _user_id: Uuid,
        _provider: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn get_connection_metadata<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _session_id: SessionId,
        _provider: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Resolves user connection tokens (e.g. GitHub) lazily at tool execution time.

Instead of eagerly injecting tokens at session creation, tools call this resolver when they need a token. If the user hasn’t connected, returns None.

Required Methods§

Source

fn get_connection_token<'life0, 'life1, 'async_trait>( &'life0 self, session_id: SessionId, provider: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a decrypted connection token for the given provider. Returns None if the user has no connection for this provider.

Provided Methods§

Source

fn get_connection_user<'life0, 'life1, 'async_trait>( &'life0 self, _session_id: SessionId, _provider: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Uuid>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve the user ID of the connection used for a session/provider pair.

This is used by leased resources to bind cleanup to the same provider identity that created the remote resource.

Source

fn get_connection_token_for_user<'life0, 'life1, 'async_trait>( &'life0 self, _user_id: Uuid, _provider: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve a provider token for a specific user.

Cleanup workers use this to avoid “first org member wins” behavior when cleaning resources created by a specific provider connection owner.

Source

fn get_connection_metadata<'life0, 'life1, 'async_trait>( &'life0 self, _session_id: SessionId, _provider: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get provider-specific metadata stored alongside the connection. Returns None if no metadata is stored or no connection exists.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§