pub enum AuthScheme {
Basic(BasicAuth),
Bearer(BearerAuth),
}Expand description
An authentication scheme applied to outgoing requests.
Authentication is configured at the client level and can be overridden or disabled per-request. The client applies auth centrally before sending, after default headers but before the hyper request is built.
§Precedence
- Request-level explicit auth (via
RequestBuilder::auth) - Request-level auth disabled (via
RequestBuilder::without_auth) - Client-level auth (via
ClientBuilder::auth) - No auth
Variants§
Basic(BasicAuth)
HTTP Basic Authentication (Authorization: Basic <credentials>).
Only available with the basic-auth feature (enabled by the http1/http2
compatibility aliases). The lean Bearer-only profile omits this variant
and its base64 dependency.
Bearer(BearerAuth)
HTTP Bearer Token Authentication (Authorization: Bearer <token>).
Implementations§
Source§impl AuthScheme
impl AuthScheme
Sourcepub fn basic(
username: impl Into<String>,
password: impl Into<String>,
) -> Result<Self>
pub fn basic( username: impl Into<String>, password: impl Into<String>, ) -> Result<Self>
Create a Basic auth scheme from username and password.
Only available with the basic-auth feature.
§Errors
Returns Error::InvalidAuthHeader if the username contains :
or if credentials contain invalid header-value bytes.
Trait Implementations§
Source§impl Clone for AuthScheme
impl Clone for AuthScheme
Source§fn clone(&self) -> AuthScheme
fn clone(&self) -> AuthScheme
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more