pub struct AuthContext { /* private fields */ }Expand description
Owned authentication challenge context passed to an Authenticator.
Implementations§
Source§impl AuthContext
impl AuthContext
pub fn new( kind: AuthKind, request_method: Method, request_uri: Uri, request_version: Version, request_headers: HeaderMap, request_extensions: Extensions, request_body: Option<RequestBody>, response_status: StatusCode, response_headers: HeaderMap, total_attempt: u32, retry_count: u32, redirect_count: u32, auth_count: u32, ) -> Self
Sourcepub fn kind(&self) -> AuthKind
pub fn kind(&self) -> AuthKind
Returns whether this is an origin or proxy authentication challenge.
Sourcepub fn request_method(&self) -> &Method
pub fn request_method(&self) -> &Method
Returns the method of the challenged request.
Sourcepub fn request_uri(&self) -> &Uri
pub fn request_uri(&self) -> &Uri
Returns the URI of the challenged request.
Sourcepub fn request_headers(&self) -> &HeaderMap
pub fn request_headers(&self) -> &HeaderMap
Returns the request headers of the challenged request.
Sourcepub fn response_status(&self) -> StatusCode
pub fn response_status(&self) -> StatusCode
Returns the response status that triggered authentication.
Sourcepub fn response_headers(&self) -> &HeaderMap
pub fn response_headers(&self) -> &HeaderMap
Returns the response headers that triggered authentication.
Sourcepub fn challenges(&self) -> Vec<AuthChallenge>
pub fn challenges(&self) -> Vec<AuthChallenge>
Parses the applicable authentication challenges from the response.
Origin contexts read WWW-Authenticate; proxy contexts read
Proxy-Authenticate. Invalid, non-UTF-8, or non-token challenge fields
are skipped.
Sourcepub fn total_attempt(&self) -> u32
pub fn total_attempt(&self) -> u32
Returns the current total attempt number for the logical call.
Sourcepub fn retry_count(&self) -> u32
pub fn retry_count(&self) -> u32
Returns the retry count accumulated before this auth decision.
Sourcepub fn redirect_count(&self) -> u32
pub fn redirect_count(&self) -> u32
Returns the redirect count accumulated before this auth decision.
Sourcepub fn auth_count(&self) -> u32
pub fn auth_count(&self) -> u32
Returns the completed auth follow-up count before this auth decision.
Sourcepub fn is_replayable(&self) -> bool
pub fn is_replayable(&self) -> bool
Returns whether the challenged request body can be replayed.
Sourcepub fn try_clone_request(&self) -> Option<Request<RequestBody>>
pub fn try_clone_request(&self) -> Option<Request<RequestBody>>
Clones the challenged request when its body is replayable.