pub struct DigestAuth {
pub username: String,
pub realm: Option<String>,
pub nonce: String,
pub uri: String,
pub response: String,
pub opaque: Option<String>,
pub algorithm: DigestAlgorithm,
pub qop: Option<DigestQop>,
pub nc: Option<String>,
pub cnonce: Option<String>,
}Fields§
§username: String§realm: Option<String>§nonce: String§uri: String§response: String§opaque: Option<String>§algorithm: DigestAlgorithm§qop: Option<DigestQop>§nc: Option<String>§cnonce: Option<String>Implementations§
Source§impl DigestAuth
impl DigestAuth
Sourcepub fn parse(header_value: &str) -> Result<Self, DigestAuthError>
pub fn parse(header_value: &str) -> Result<Self, DigestAuthError>
Parse an Authorization header value of the form Digest ....
Sourcepub fn compute_expected_response(
&self,
method: Method,
realm: &str,
password: &str,
) -> Result<String, DigestAuthError>
pub fn compute_expected_response( &self, method: Method, realm: &str, password: &str, ) -> Result<String, DigestAuthError>
Compute the expected response= value for this challenge (lower hex).
Supports:
- algorithms: MD5, MD5-sess, SHA-256, SHA-256-sess
- qop: auth (auth-int is rejected)
Sourcepub fn verify(
&self,
method: Method,
realm: &str,
password: &str,
) -> Result<bool, DigestAuthError>
pub fn verify( &self, method: Method, realm: &str, password: &str, ) -> Result<bool, DigestAuthError>
Verify response= against the expected value (timing-safe).
Sourcepub fn verify_for_challenge(
&self,
method: Method,
realm: &str,
nonce: &str,
password: &str,
) -> Result<bool, DigestAuthError>
pub fn verify_for_challenge( &self, method: Method, realm: &str, nonce: &str, password: &str, ) -> Result<bool, DigestAuthError>
Verify with challenge constraints, including nonce/realm matching.
Trait Implementations§
Source§impl Clone for DigestAuth
impl Clone for DigestAuth
Source§fn clone(&self) -> DigestAuth
fn clone(&self) -> DigestAuth
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DigestAuth
impl Debug for DigestAuth
Source§impl FromRequest for DigestAuth
impl FromRequest for DigestAuth
Source§type Error = DigestAuthError
type Error = DigestAuthError
Error type when extraction fails.
Source§async fn from_request(
_ctx: &RequestContext,
req: &mut Request,
) -> Result<Self, Self::Error>
async fn from_request( _ctx: &RequestContext, req: &mut Request, ) -> Result<Self, Self::Error>
Extract a value from the request. Read more
Source§impl PartialEq for DigestAuth
impl PartialEq for DigestAuth
impl Eq for DigestAuth
impl StructuralPartialEq for DigestAuth
Auto Trait Implementations§
impl Freeze for DigestAuth
impl RefUnwindSafe for DigestAuth
impl Send for DigestAuth
impl Sync for DigestAuth
impl Unpin for DigestAuth
impl UnwindSafe for DigestAuth
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).