Class BasicAuthorizationHeader
- 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()