Skip to main content

ChannelLogin

Trait ChannelLogin 

Source
pub trait ChannelLogin: Send + Sync {
    // Provided methods
    fn authcode_start<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _client: &'life1 Arc<dyn UpstreamClient>,
        _ctx: AuthCodeStartCtx<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<AuthCodeStart>, ChannelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn authcode_exchange<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _client: &'life1 Arc<dyn UpstreamClient>,
        _ctx: AuthCodeExchangeCtx<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<Value, ChannelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn device_start<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _client: &'life1 Arc<dyn UpstreamClient>,
        _ctx: DeviceStartCtx<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<DeviceInit, ChannelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn device_poll<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _client: &'life1 Arc<dyn UpstreamClient>,
        _ctx: DevicePollCtx<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<DevicePoll, ChannelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn cookie_exchange<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _client: &'life1 Arc<dyn UpstreamClient>,
        _ctx: CookieExchangeCtx<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<Value, ChannelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

Interactive OAuth authorization-code (+PKCE) login for a channel.

Defaults make the trait opt-in: a channel that does not override returns None from authcode_start (no authcode flow) and Unsupported from authcode_exchange.

Provided Methods§

Source

fn authcode_start<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _client: &'life1 Arc<dyn UpstreamClient>, _ctx: AuthCodeStartCtx<'life2>, ) -> Pin<Box<dyn Future<Output = Result<Option<AuthCodeStart>, ChannelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Build the provider authorize URL for an authcode+PKCE login. Ok(None) means the channel has no authcode flow. An empty redirect_uri tells the channel to use its own default (returned in AuthCodeStart).

Async + client-bearing so a channel can do a pre-authorize round-trip (e.g. AWS IdC dynamic client registration) before producing the URL. params is opaque operator-supplied input (auth_method, region, start_url, …); {} for the common static flow.

Source

fn authcode_exchange<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _client: &'life1 Arc<dyn UpstreamClient>, _ctx: AuthCodeExchangeCtx<'life2>, ) -> Pin<Box<dyn Future<Output = Result<Value, ChannelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Exchange an authorization code (+ the PKCE verifier) for the PLAINTEXT secret Value. redirect_uri MUST equal the one authcode_start used. extra is the AuthCodeStart::extra that start stashed (e.g. the registered IdC client creds); None for static flows. The caller seals + persists the returned Value (purity: the channel never touches cipher/persistence).

Source

fn device_start<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _client: &'life1 Arc<dyn UpstreamClient>, _ctx: DeviceStartCtx<'life2>, ) -> Pin<Box<dyn Future<Output = Result<DeviceInit, ChannelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Begin a device-code login: ask the provider for a device + user code. None-by-default channels return Unsupported. The caller stashes the returned device_code server-side and polls device_poll.

params is opaque operator-supplied input (mirrors authcode_start) — e.g. {"login_provider":"google"} to pick the Kiro social provider; {} for the channel default.

Source

fn device_poll<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _client: &'life1 Arc<dyn UpstreamClient>, _ctx: DevicePollCtx<'life2>, ) -> Pin<Box<dyn Future<Output = Result<DevicePoll, ChannelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Poll a pending device-code login with the device_code from device_start. Returns DevicePoll::Ready with the PLAINTEXT secret once authorized (the caller seals + persists), else Pending/Denied.

Source

fn cookie_exchange<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _client: &'life1 Arc<dyn UpstreamClient>, _ctx: CookieExchangeCtx<'life2>, ) -> Pin<Box<dyn Future<Output = Result<Value, ChannelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Exchange a session cookie for the PLAINTEXT secret Value (the caller seals + persists). For channels whose first-credential bootstrap is a browser session cookie rather than an interactive OAuth dance.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§