Crate http_auth[][src]

Expand description

HTTP authentication. Currently meant for clients; to be extended for servers.

As described in the following documents and specifications:

This framework is primarily used with HTTP, as suggested by the name. It is also used by some other protocols such as RTSP.

Quick example:

use std::convert::TryFrom;
let WWW_AUTHENTICATE = "UnsupportedSchemeA, Basic realm=\"foo\", UnsupportedSchemeB";
let mut pw_client = http_auth::PasswordClient::try_from(WWW_AUTHENTICATE).unwrap();
assert!(matches!(pw_client, http_auth::PasswordClient::Basic(_)));
let response = pw_client.respond(&http_auth::PasswordParams {
    username: "Aladdin",
    password: "open sesame",
    uri: "/",
    method: "GET",
    body: Some(&[]),
}).unwrap();
assert_eq!(response, "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");

Re-exports

pub use parser::ChallengeParser;
pub use crate::basic::BasicClient;
pub use crate::digest::DigestClient;

Modules

basicbasic-scheme

Basic authentication scheme as in RFC 7617.

digestdigest-scheme

Digest authentication scheme, as in RFC 7616.

Parses as in RFC 7235.

Structs

Parsed challenge (scheme and body) using references to the original header value.

Parsed parameter value.

Builds a PasswordClient from the supplied challenges.

Parameters for responding to a password challenge.

Enums

Client for responding to a password challenge.

Functions

Parses a list of challenges into a Vec.