Skip to main content

CookieProvider

Trait CookieProvider 

Source
pub trait CookieProvider:
    'static
    + Send
    + Sync {
    // Required methods
    fn cookies<'life0, 'life1, 'async_trait>(
        &'life0 self,
        hostname: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Vec<(String, String)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn acquire_cookie<'life0, 'life1, 'async_trait>(
        &'life0 self,
        hostname: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), AcquireCookieError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn needs_bootstrap<'life0, 'life1, 'async_trait>(
        &'life0 self,
        hostname: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Abstraction for acquiring and retrieving SSO load balancer cookies.

Allows bitwarden-core to request cookies without depending on bitwarden-server-communication-config. Middleware holds Arc<dyn CookieProvider>.

§Security

Implementors MUST NOT log cookie values. Cookie values are sensitive SSO tokens.

Required Methods§

Source

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

Returns stored cookies for the given hostname as name-value pairs.

Returns an empty vec when no cookies are stored for the hostname.

Acquires a fresh cookie from the platform and stores it for the given hostname.

Triggers the platform-specific SSO acquisition flow (e.g., WebView redirect).

Source

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

Returns true if the hostname requires SSO cookie bootstrapping.

Returns false when no configuration exists for the hostname, or when the configuration is Direct (no cookie required). Middleware uses this to skip acquisition on redirects unrelated to SSO bootstrapping.

Implementors§