Skip to main content

AuthManager

Trait AuthManager 

Source
pub trait AuthManager:
    Debug
    + Send
    + Sync {
    // Required methods
    fn init_session<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        client: &'life1 HttpClient,
        props: &'life2 HashMap<String, String>,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn AuthSession>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn catalog_session<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        client: &'life1 HttpClient,
        props: &'life2 HashMap<String, String>,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn AuthSession>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Creates the AuthSessions used to authenticate REST catalog requests.

A manager is created once per catalog, either from the rest.auth.type property or injected through RestCatalogBuilder::with_auth_manager or RestSessionCatalogBuilder::with_auth_manager. It builds the sessions the catalog then keeps.

Both methods are handed the catalog’s HttpClient, which an implementation may reuse for its own requests (e.g. a token exchange) so that they share the catalog’s connection pool and configuration.

Required Methods§

Source

fn init_session<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, client: &'life1 HttpClient, props: &'life2 HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn AuthSession>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Session used for the initial /v1/config handshake, given the user-supplied properties.

Returns a Box: an init session is used once and released, unlike the shared AuthManager::catalog_session.

Source

fn catalog_session<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, client: &'life1 HttpClient, props: &'life2 HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn AuthSession>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Session used for all subsequent catalog requests, given the properties merged from the user configuration and the server’s config response.

Returns an Arc: this session is shared by concurrent requests for the rest of the catalog’s lifetime. Implementations may carry state (e.g. a cached token) over from the init session.

Implementors§