Authlete
BasicCredentials Class Reference

A class that represents a pair of user ID and password and provides Formatted property which returns a string suitable as a value of Authorization header for Basic Authentication. More...

Public Member Functions

 BasicCredentials (string userId, string password)
 Constructor with a pair of user ID and password. More...
 

Static Public Member Functions

static BasicCredentials Parse (AuthenticationHeaderValue value)
 Create a BasicCredentials instance from the given AuthenticationHeaderValue instance. If null is given or if the scheme of the AuthenticationHeaderValue instance is not "Basic", a BasicCredentials instance whose UserId and Password are both null is returned. More...
 
static BasicCredentials Parse (string value)
 Create a BasicCredentials instance from the given string whose format is expected to be "Basic {base64-encoded-string}". If the given string is null or it does not match the pattern, a BasicCredentials instance whose UserId and Password are both null is returned. More...
 

Properties

string UserId [get]
 The user ID. More...
 
string Password [get]
 The password. More...
 
string Formatted [get]
 A string in "Basic {base64-encoded-string}" format which is suitable as a value of Authorization header for Basic Authentication. More...
 
string FormattedParameter [get]
 A string in "{base64-encoded-string}" format which is suitable as a value of the parameter part of Authorization header for Basic Authentication. More...
 

Detailed Description

A class that represents a pair of user ID and password and provides Formatted property which returns a string suitable as a value of Authorization header for Basic Authentication.

Constructor & Destructor Documentation

◆ BasicCredentials()

BasicCredentials ( string  userId,
string  password 
)
inline

Constructor with a pair of user ID and password.

Member Function Documentation

◆ Parse() [1/2]

static BasicCredentials Parse ( AuthenticationHeaderValue  value)
inlinestatic

Create a BasicCredentials instance from the given AuthenticationHeaderValue instance. If null is given or if the scheme of the AuthenticationHeaderValue instance is not "Basic", a BasicCredentials instance whose UserId and Password are both null is returned.

Returns
A BasicCredentials instance generated based on the information of the given AuthenticationHeaderValue instance.
Parameters
valueA value of Authorization header whose scheme is "Basic".

◆ Parse() [2/2]

static BasicCredentials Parse ( string  value)
inlinestatic

Create a BasicCredentials instance from the given string whose format is expected to be "Basic {base64-encoded-string}". If the given string is null or it does not match the pattern, a BasicCredentials instance whose UserId and Password are both null is returned.

Returns
A BasicCredentials instance generated based on the information of the given string.
Parameters
valueA value of Authorization header whose scheme is "Basic".

Property Documentation

◆ Formatted

string Formatted
get

A string in "Basic {base64-encoded-string}" format which is suitable as a value of Authorization header for Basic Authentication.

◆ FormattedParameter

string FormattedParameter
get

A string in "{base64-encoded-string}" format which is suitable as a value of the parameter part of Authorization header for Basic Authentication.

Since version 1.0.1

◆ Password

string Password
get

The password.

◆ UserId

string UserId
get

The user ID.


The documentation for this class was generated from the following file: