Skip to main content

Module auth

Module auth 

Source
Expand description

Auth provider traits, dispatch, and built-in provider commands. Auth provider abstraction and built-in auth helpers.

Consumer CLIs normally register one or more AuthProvider implementations with crate::CliConfig. Middleware then resolves credentials before business logic runs and passes a Credential to command handlers.

The module also contains an crate::auth::exec::ExecProvider for provider binaries that speak the JSON stdin/stdout contract.

When the pkce-auth feature is enabled, pkce::PkceAuthProvider adds a built-in browser-based OAuth 2.0 PKCE flow with system keychain storage.

Re-exports§

pub use commands::AuthLoginResult;
pub use commands::AuthStatusEntry;
pub use commands::auth_command_group;
pub use commands::login_and_build;
pub use commands::login_and_build_with_scopes;
pub use commands::logout_result;
pub use commands::status_result;
pub use commands::to_status_entry;
pub use exec::ACTION_AUTHENTICATE;
pub use exec::ACTION_LIST_ENVIRONMENTS;
pub use exec::ACTION_LIST_REALMS;
pub use exec::ACTION_LOGOUT;
pub use exec::ACTION_STATUS;
pub use exec::AuthnRequest;
pub use exec::EnvironmentsResponse;
pub use exec::ExecProvider;
pub use storage::CredentialKey;
pub use storage::CredentialStorage;
pub use storage::FileStorage;
pub use storage::default_storage;
pub use storage::storage_for;

Modules§

commands
Built-in auth login, auth status, and auth logout command helpers.
exec
External process auth provider implementation.
storage
Pluggable credential storage backends (keychain, file, auto). Injectable credential storage backends.

Structs§

Credential
Credential returned by an auth provider.
CredentialRequest
Everything an AuthProvider may inspect about the command requesting a credential.
Dispatcher
Routes auth operations to registered providers by name.
SingleProvider
Single-provider facade over a shared Dispatcher.
StatusEntry
Status row produced while querying all providers.

Constants§

CACHE_TTL
Cache TTL used when a credential has cached_at.

Traits§

AuthProvider
Named auth provider used by middleware and transport injectors.