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§
Required Methods§
Sourcefn authenticate(
&self,
credential: Credential,
metadata: CredentialMetadata,
) -> impl Future<Output = Result<Self::MethodResult>> + Send
fn authenticate( &self, credential: Credential, metadata: CredentialMetadata, ) -> impl Future<Output = Result<Self::MethodResult>> + Send
Authenticate using the provided credentials.
Sourcefn validate_config(&self) -> Result<()>
fn validate_config(&self) -> Result<()>
Validate configuration for this method.
Provided Methods§
Sourcefn supports_refresh(&self) -> bool
fn supports_refresh(&self) -> bool
Check if this method supports refresh tokens.
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.