pub enum AuthScheme<'a> {
Basic {
username: &'a str,
password: &'a str,
},
Bearer {
token: &'a str,
},
Digest(DigestBuilder<'a>),
HOBA {
result: String,
},
Mutual {
credentials: &'a str,
},
Negotiate {
token: &'a str,
},
Vapid {
public_key: &'a str,
subject: &'a str,
signature: String,
},
Scram {
variant: SCRAMVariant,
credentials: String,
},
Aws4HmacSha256 {
access_key: &'a str,
signature: String,
region: &'a str,
service: &'a str,
date: String,
},
Custom {
scheme: &'a str,
credentials: &'a str,
},
}api only.Variants§
Basic
Basic authentication - RFC 7617 Credentials: username:password encoded in base64 Security: LOW - credentials are easily decoded Usage: Simple username/password authentication
Bearer
Bearer token authentication - RFC 6750
Credentials: Token (usually JWT or OAuth 2.0 access token)
Security: HIGH - depends on token implementation
Usage: OAuth 2.0, JWT, API tokens
Digest(DigestBuilder<'a>)
Digest authentication - RFC 7616 Credentials: Hashed challenge-response using MD5/SHA Security: MEDIUM - prevents password transmission, vulnerable to rainbow tables Usage: Enhanced security over Basic auth
HOBA
HTTP Origin-Bound Authentication - RFC 7486 Credentials: Digital signature-based Security: HIGH - not vulnerable to phishing attacks Usage: Advanced security scenarios, no password storage needed
Mutual
Mutual authentication - RFC 8120 Credentials: Bidirectional authentication Security: HIGH - both client and server authenticate each other Usage: High-security environments, certificate-based auth
Negotiate
Negotiate/NTLM authentication - RFC 4559 Credentials: SPNEGO for Kerberos/NTLM Security: HIGH - enterprise-grade authentication Usage: Windows domain authentication, SSO
Vapid
VAPID authentication - RFC 8292 Credentials: Voluntary Application Server Identification Security: MEDIUM - for web push notifications Usage: Web push services, contact information verification
Scram
SCRAM authentication - RFC 7804 Credentials: SASL mechanisms (SHA-1, SHA-256) Security: HIGH - salted challenge-response Usage: Database authentication, secure challenge-response
Aws4HmacSha256
AWS Signature Version 4 - AWS documentation Credentials: HMAC-SHA256 signature Security: HIGH - signed requests with access keys Usage: AWS API authentication
Custom
Custom authentication scheme Credentials: User-defined Security: Varies Usage: Proprietary or non-standard auth schemes
Implementations§
Source§impl<'a> AuthScheme<'a>
impl<'a> AuthScheme<'a>
pub fn basic(username: &'a str, password: &'a str) -> Self
pub fn bearer(token: &'a str) -> Self
pub fn digest(digest: DigestBuilder<'a>) -> Self
pub fn hoba(result: impl Into<String>) -> Self
pub fn mutual(credentials: &'a str) -> Self
pub fn negotiate(token: &'a str) -> Self
pub fn vapid( public_key: &'a str, subject: &'a str, signature: impl Into<String>, ) -> Self
pub fn scram(variant: SCRAMVariant, credentials: impl Into<String>) -> Self
pub fn aws4_hmac_sha256( access_key: &'a str, signature: impl Into<String>, region: &'a str, service: &'a str, date: impl Into<String>, ) -> Self
pub fn custom(scheme: &'a str, credentials: &'a str) -> Self
pub fn to_header_value(self) -> Result<HeaderValue, Error>
pub fn scheme_name(&self) -> &str
Trait Implementations§
Source§impl<'a> Clone for AuthScheme<'a>
impl<'a> Clone for AuthScheme<'a>
Source§fn clone(&self) -> AuthScheme<'a>
fn clone(&self) -> AuthScheme<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for AuthScheme<'a>
impl<'a> Debug for AuthScheme<'a>
Source§impl<'a> Display for AuthScheme<'a>
impl<'a> Display for AuthScheme<'a>
Source§impl<'a> Hash for AuthScheme<'a>
impl<'a> Hash for AuthScheme<'a>
Source§impl<'a> PartialEq for AuthScheme<'a>
impl<'a> PartialEq for AuthScheme<'a>
impl<'a> Eq for AuthScheme<'a>
impl<'a> StructuralPartialEq for AuthScheme<'a>
Auto Trait Implementations§
impl<'a> Freeze for AuthScheme<'a>
impl<'a> RefUnwindSafe for AuthScheme<'a>
impl<'a> Send for AuthScheme<'a>
impl<'a> Sync for AuthScheme<'a>
impl<'a> Unpin for AuthScheme<'a>
impl<'a> UnwindSafe for AuthScheme<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.