pub struct Dispatcher { /* private fields */ }Expand description
Routes auth operations to registered providers by name.
Clones share the same provider registry, so provider facades and transport injectors see later registration or replacement.
Implementations§
Source§impl Dispatcher
impl Dispatcher
Sourcepub fn register(&mut self, provider: Arc<dyn AuthProvider>)
pub fn register(&mut self, provider: Arc<dyn AuthProvider>)
Registers or replaces a provider under its AuthProvider::name.
Sourcepub fn registered_names(&self) -> Vec<String>
pub fn registered_names(&self) -> Vec<String>
Returns provider names in registration order.
Sourcepub async fn get_credential(
&self,
name: &str,
env: &str,
command: &str,
tier: &str,
) -> Result<Credential>
pub async fn get_credential( &self, name: &str, env: &str, command: &str, tier: &str, ) -> Result<Credential>
Gets a credential from a named provider.
Sourcepub async fn get_credential_for(
&self,
name: &str,
req: &CredentialRequest<'_>,
) -> Result<Credential>
pub async fn get_credential_for( &self, name: &str, req: &CredentialRequest<'_>, ) -> Result<Credential>
Gets a credential from a named provider, passing the command’s full
CredentialRequest so metadata-aware providers (e.g. OAuth scope
step-up) can act on it.
Sourcepub async fn login(&self, name: &str, env: &str) -> Result<Credential>
pub async fn login(&self, name: &str, env: &str) -> Result<Credential>
Clears any cached credential, ignoring logout failures, then authenticates.
Sourcepub async fn login_with_scopes(
&self,
name: &str,
env: &str,
additional_scopes: &[String],
) -> Result<Credential>
pub async fn login_with_scopes( &self, name: &str, env: &str, additional_scopes: &[String], ) -> Result<Credential>
Like login, but requests additional_scopes on top
of the provider’s defaults.
The scopes are carried as CommandMeta::scopes on a synthesized
request; providers without scope support ignore them.
Sourcepub async fn status(&self, name: &str, env: &str) -> Result<Credential>
pub async fn status(&self, name: &str, env: &str) -> Result<Credential>
Gets cached credential status from a named provider.
Sourcepub async fn logout(&self, name: &str, env: &str) -> Result<()>
pub async fn logout(&self, name: &str, env: &str) -> Result<()>
Clears cached credentials for a named provider and environment.
Sourcepub async fn all_statuses(&self) -> Vec<StatusEntry>
pub async fn all_statuses(&self) -> Vec<StatusEntry>
Queries every provider for every cached environment it reports.
Sourcepub fn for_provider(&self, name: impl Into<String>) -> SingleProvider
pub fn for_provider(&self, name: impl Into<String>) -> SingleProvider
Returns an auth-provider facade backed by this dispatcher.
Trait Implementations§
Source§impl Clone for Dispatcher
impl Clone for Dispatcher
Source§fn clone(&self) -> Dispatcher
fn clone(&self) -> Dispatcher
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more