Skip to main content

AuthProvider

Trait AuthProvider 

Source
pub trait AuthProvider:
    Send
    + Sync
    + Debug {
    // Required methods
    fn name(&self) -> &str;
    fn get_credential<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        env: &'life1 str,
        command: &'life2 str,
        tier: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<Credential>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn status<'life0, 'life1, 'async_trait>(
        &'life0 self,
        env: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Credential>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn logout<'life0, 'life1, 'async_trait>(
        &'life0 self,
        env: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_environments<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn get_credential_for<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        req: &'life1 CredentialRequest<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<Credential>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

Named auth provider used by middleware and transport injectors.

Implementations own their credential cache strategy. The framework only routes calls and passes command context (env, colon command path, and tier).

Required Methods§

Source

fn name(&self) -> &str

Stable provider registration name, for example primary or oauth.

Source

fn get_credential<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, env: &'life1 str, command: &'life2 str, tier: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Credential>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Returns a credential for env, command, and tier.

Source

fn status<'life0, 'life1, 'async_trait>( &'life0 self, env: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Credential>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns cached credential status for one environment.

Source

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

Clears cached credentials for one environment.

Source

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

Lists environments with cached credentials.

Provided Methods§

Source

fn get_credential_for<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, req: &'life1 CredentialRequest<'life2>, ) -> Pin<Box<dyn Future<Output = Result<Credential>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Returns a credential for a command, given its full CredentialRequest.

The default implementation ignores the metadata and delegates to get_credential. Providers that act on command metadata — such as an OAuth provider performing scope step-up from CommandMeta::scopes — override this. The framework calls this method (not get_credential) when resolving credentials, so an override receives the command’s metadata.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§