AuthMethod

Trait AuthMethod 

Source
pub trait AuthMethod: Send + Sync {
    type MethodResult: Send + Sync + 'static;
    type AuthToken: Send + Sync + 'static;

    // Required methods
    fn name(&self) -> &str;
    fn authenticate(
        &self,
        credential: Credential,
        metadata: CredentialMetadata,
    ) -> impl Future<Output = Result<Self::MethodResult>> + Send;
    fn validate_config(&self) -> Result<()>;

    // Provided methods
    fn supports_refresh(&self) -> bool { ... }
    fn refresh_token(
        &self,
        _refresh_token: String,
    ) -> impl Future<Output = Result<AuthToken, AuthError>> + Send { ... }
}
Expand description

Trait for authentication methods.

Required Associated Types§

Source

type MethodResult: Send + Sync + 'static

Source

type AuthToken: Send + Sync + 'static

Required Methods§

Source

fn name(&self) -> &str

Get the name of this authentication method.

Source

fn authenticate( &self, credential: Credential, metadata: CredentialMetadata, ) -> impl Future<Output = Result<Self::MethodResult>> + Send

Authenticate using the provided credentials.

Source

fn validate_config(&self) -> Result<()>

Validate configuration for this method.

Provided Methods§

Source

fn supports_refresh(&self) -> bool

Check if this method supports refresh tokens.

Source

fn refresh_token( &self, _refresh_token: String, ) -> impl Future<Output = Result<AuthToken, AuthError>> + Send

Refresh a token if supported.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§