Description
The "Basic" Hypertext Transfer Protocol (HTTP) authentication scheme, transmits credentials as user-id/password pairs, encoded using Base64.
The server will gather the credentials from the base64 encoded header value, and will validate them to authenticate the user in question.
This crate covers the credentials encoding and decoding. The Credentials
struct provides two fields
user_id
and password
, these are filled with they raw values.
Usage
Decoding a basic authorization value and creating a Credentials
struct
from it
use Credentials;
let auth_header_value = String from;
let credentials = from_header.unwrap;
assert_eq!;
assert_eq!;
Encoding Credentials
into a basic authorization header value.
use Credentials;
let credentials = new;
let credentials = credentials.as_http_header;
assert_eq!;
Release
Contributing
Every contribution to this project is welcome! Feel free to open a pull request or an issue.
References
License
Distributed under the terms of both the MIT license and the Apache License (Version 2.0)