Class BasicAuthorizationHeader
- Namespace
- Cuemon.AspNetCore.Authentication.Basic
- Assembly
- Cuemon.AspNetCore.Authentication.dll
Provides a representation of a HTTP Basic Authentication header. Implements the AuthorizationHeader
public class BasicAuthorizationHeader : AuthorizationHeader
- Inheritance
-
BasicAuthorizationHeader
- Inherited Members
Constructors
BasicAuthorizationHeader(string, string)
Initializes a new instance of the BasicAuthorizationHeader class.
public BasicAuthorizationHeader(string username, string password)
Parameters
Exceptions
- ArgumentNullException
username
cannot be null -or-password
cannot be null.- ArgumentException
username
cannot be empty or consist only of white-space characters -or-password
cannot be empty or consist only of white-space characters -or-username
does not allow the presence of the colon character.
Fields
Scheme
The default authentication scheme of the BasicAuthorizationHeader.
public const string Scheme = "Basic"
Field Value
Properties
Password
Gets the password of the credentials.
public string Password { get; }
Property Value
- string
The password of the credentials.
UserName
Gets the username of the credentials.
public string UserName { get; }
Property Value
- string
The username of the credentials.
Methods
Create(string)
Creates an instance of BasicAuthorizationHeader from the specified parameters.
public static BasicAuthorizationHeader Create(string authorizationHeader)
Parameters
authorizationHeader
stringThe raw HTTP authorization header.
Returns
- BasicAuthorizationHeader
An instance of BasicAuthorizationHeader.
Exceptions
- ArgumentNullException
authorizationHeader
cannot be null.- ArgumentException
authorizationHeader
cannot be empty or consist only of white-space characters.
Parse(string, Action<AuthorizationHeaderOptions>)
Parses the specified authorizationHeader
.
public override AuthorizationHeader Parse(string authorizationHeader, Action<AuthorizationHeaderOptions> setup)
Parameters
authorizationHeader
stringThe authorization header to parse.
setup
Action<AuthorizationHeaderOptions>The AuthorizationHeaderOptions which need to be configured.
Returns
- AuthorizationHeader
An AuthorizationHeader equivalent of
authorizationHeader
.
ParseCore(IReadOnlyDictionary<string, string>)
The core parser that resolves an AuthorizationHeader from a set of credentials
.
protected override AuthorizationHeader ParseCore(IReadOnlyDictionary<string, string> credentials)
Parameters
credentials
IReadOnlyDictionary<string, string>The credentials used in authentication.
Returns
- AuthorizationHeader
An AuthorizationHeader equivalent of
credentials
.
ToString()
Returns a string that represents this instance.
public override string ToString()