pub struct DigestAuthenticator { /* private fields */ }Expand description
SIP Digest authenticator for generating challenges and validating responses.
Implementations§
Source§impl DigestAuthenticator
impl DigestAuthenticator
pub fn new(realm: impl Into<String>) -> DigestAuthenticator
Sourcepub fn with_algorithm(self, algorithm: DigestAlgorithm) -> DigestAuthenticator
pub fn with_algorithm(self, algorithm: DigestAlgorithm) -> DigestAuthenticator
Select the algorithm used in newly generated challenges.
pub fn generate_challenge(&self) -> DigestChallenge
pub fn format_www_authenticate(&self, challenge: &DigestChallenge) -> String
Sourcepub fn format_www_authenticate_with_stale(
&self,
challenge: &DigestChallenge,
stale: bool,
) -> String
pub fn format_www_authenticate_with_stale( &self, challenge: &DigestChallenge, stale: bool, ) -> String
Format a digest challenge with an optional RFC 7616 stale=true flag.
Sourcepub fn validate_response(
&self,
response: &DigestResponse,
method: &str,
password: &str,
) -> Result<bool, AuthError>
pub fn validate_response( &self, response: &DigestResponse, method: &str, password: &str, ) -> Result<bool, AuthError>
Validate a digest response against the stored password.
Honors the algorithm carried on the response (MD5 /
MD5-sess / SHA-256 / SHA-256-sess / SHA-512-256 /
SHA-512-256-sess) — clients sending SHA-based digests are
validated with the advertised hash, not silently downgraded.
Sourcepub fn validate_response_with_body(
&self,
response: &DigestResponse,
method: &str,
password: &str,
body: Option<&[u8]>,
) -> Result<bool, AuthError>
pub fn validate_response_with_body( &self, response: &DigestResponse, method: &str, password: &str, body: Option<&[u8]>, ) -> Result<bool, AuthError>
Like Self::validate_response but also accepts the request
body so qop=auth-int validation can include it in HA2.
Sourcepub fn validate_response_with_secret(
&self,
response: &DigestResponse,
method: &str,
secret: &DigestSecret,
) -> Result<bool, AuthError>
pub fn validate_response_with_secret( &self, response: &DigestResponse, method: &str, secret: &DigestSecret, ) -> Result<bool, AuthError>
Validate a digest response against provider-supplied secret material.
DigestSecret::Ha1 lets a server validate SIP Digest without storing
plaintext SIP passwords. The HA1 value must be the base
H(username:realm:password) value; -sess algorithms fold nonce and
cnonce in this method.
Sourcepub fn validate_response_with_secret_and_body(
&self,
response: &DigestResponse,
method: &str,
secret: &DigestSecret,
body: Option<&[u8]>,
) -> Result<bool, AuthError>
pub fn validate_response_with_secret_and_body( &self, response: &DigestResponse, method: &str, secret: &DigestSecret, body: Option<&[u8]>, ) -> Result<bool, AuthError>
Like Self::validate_response_with_secret but also accepts the
request body for qop=auth-int validation.
Sourcepub fn parse_challenge(header: &str) -> Result<DigestChallenge, AuthError>
pub fn parse_challenge(header: &str) -> Result<DigestChallenge, AuthError>
Parse WWW-Authenticate header to extract challenge.
Sourcepub fn parse_challenge_details(
header: &str,
) -> Result<DigestChallengeDetails, AuthError>
pub fn parse_challenge_details( header: &str, ) -> Result<DigestChallengeDetails, AuthError>
Parse WWW-Authenticate / Proxy-Authenticate header to extract the
challenge plus metadata such as stale=true.
Parse Authorization header to extract response.
Trait Implementations§
Source§impl Clone for DigestAuthenticator
impl Clone for DigestAuthenticator
Source§fn clone(&self) -> DigestAuthenticator
fn clone(&self) -> DigestAuthenticator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DigestAuthenticator
impl RefUnwindSafe for DigestAuthenticator
impl Send for DigestAuthenticator
impl Sync for DigestAuthenticator
impl Unpin for DigestAuthenticator
impl UnsafeUnpin for DigestAuthenticator
impl UnwindSafe for DigestAuthenticator
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more