Trait Auth

Source
pub trait Auth: Send + Sync {
    // Required methods
    fn provider_id(&self) -> &str;
    fn get_credentials<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<AuthCredentials>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_credentials<'life0, 'async_trait>(
        &'life0 self,
        credentials: AuthCredentials,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn remove_credentials<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn has_credentials<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Authentication trait for provider credentials

Required Methods§

Source

fn provider_id(&self) -> &str

Get the provider ID this auth is for

Source

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

Get current valid credentials

Source

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

Store new credentials

Source

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

Remove stored credentials

Source

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

Check if credentials are available

Implementors§