Skip to main content

create_auth_provider

Function create_auth_provider 

Source
pub fn create_auth_provider(
    cfg: &AuthConfig,
) -> Result<Arc<dyn HttpAuthProvider>, HttpConnectorError>
Expand description

Build a STATIC auth provider from cfg, shared as Arc<dyn HttpAuthProvider>.

For AuthConfig::OAuthPassthrough, use create_passthrough_auth_provider instead โ€” without a token this returns a MissingTokenAuth (if required) or NoAuth, since the per-request token is not yet known at startup.

ยงErrors

Returns HttpConnectorError::Auth when a credential field is a MALFORMED environment reference (see AuthConfig::malformed_env_ref_field). This is the construction-time validation the fallible signature was reserved for: a malformed reference used to resolve to the empty string and be OMITTED, which silently produced an unauthenticated client.

An UNSET or empty variable is NOT an error โ€” that remains the deliberate omission policy (the provider collapses to NoAuth).