Skip to main content

extract_header_basic_credentials

Function extract_header_basic_credentials 

Source
pub fn extract_header_basic_credentials(
    headers: &HeaderMap,
) -> Result<Option<&str>, Error>
Expand description

Extract raw Basic credentials from the Authorization field.

Scheme matching is ASCII case-insensitive and requires at least one ASCII space. Only the first required space is consumed; any additional spaces are preserved in the returned credentials. Basic therefore produces Some(""). A missing field, another scheme, or a scheme without the required space returns None. Duplicate or non-text Authorization fields return an error before scheme matching. This function does not validate or Base64-decode the credential, split a user name and password, or authenticate it. The returned credential is sensitive. See RFC 7617, Section 2.