[][src]Struct http_auth_basic::Credentials

pub struct Credentials {
    pub user_id: String,
    pub password: String,
}

A struct to represent the user_id and password fields from an Authorization Basic header value

Fields

user_id: Stringpassword: String

Implementations

impl Credentials[src]

pub fn new(user_id: &str, password: &str) -> Self[src]

Create a new Credentials instance this is equivalent to writing:

use http_auth_basic::Credentials;

let credentials = Credentials {
    user_id: String::from("Foo"),
    password: String::from("Bar"),
};

pub fn decode(auth_header_value: String) -> Result<Self, AuthBasicError>[src]

Create a Credentials instance from a base64 String which must encode user credentials as username:password

pub fn encode(&self) -> String[src]

Encode a Credentials instance into a base64 String

pub fn from_header(auth_header: String) -> Result<Credentials, AuthBasicError>[src]

Creates a Credentials instance from an HTTP Authorization header which schema is a valid Basic HTTP Authorization Schema.

pub fn as_http_header(&self) -> String[src]

Creates a HTTP Authorization header value for the basic schema from the Credentials instance

Trait Implementations

impl Debug for Credentials[src]

impl PartialEq<Credentials> for Credentials[src]

impl StructuralPartialEq for Credentials[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.