BasicAuthorizationHeaderBuilder Class
Definition
- Namespace
- Cuemon.AspNetCore.Authentication.Basic
- Assemblies
- Cuemon.AspNetCore.Authentication.dll
Provides a way to fluently represent a HTTP Basic Authentication header.
public class BasicAuthorizationHeaderBuilder : AuthorizationHeaderBuilder<BasicAuthorizationHeader, BasicAuthorizationHeaderBuilder>
- Inheritance
-
BasicAuthorizationHeaderBuilder
- Inherited Members
Examples
The following example demonstrates how to build a Basic Authorization header value using BasicAuthorizationHeaderBuilder.
using Cuemon.AspNetCore.Authentication.Basic;
namespace MyApp.Examples;
public class BasicAuthorizationHeaderBuilderExample
{
public void Demonstrate()
{
var builder = new BasicAuthorizationHeaderBuilder();
builder.AddUserName("alice");
builder.AddPassword("password");
var headerValue = builder.Build(); // "Basic YWxpY2U6cGFzc3dvcmQ="
}
}
Constructors
| Name | Description |
|---|---|
| BasicAuthorizationHeaderBuilder() | Initializes a new instance of the BasicAuthorizationHeaderBuilder class. |
Methods
| Name | Description |
|---|---|
| AddPassword(string) | Adds the client identifier that is the public key of the signing process. |
| AddUserName(string) | Adds the credential scope that defines the remote resource. |
| Build() | Builds an instance of BasicAuthorizationHeader that implements AuthorizationHeader. |