DigestAuthorizationHeader Class
Definition
- Namespace
- Cuemon.AspNetCore.Authentication.Digest
- Assemblies
- Cuemon.AspNetCore.Authentication.dll
Provides a representation of a HTTP Digest Access Authentication header. Implements the AuthorizationHeader
public class DigestAuthorizationHeader : AuthorizationHeader
- Inheritance
-
DigestAuthorizationHeader
- Inherited Members
Examples
The following example demonstrates how to serialize and parse a Digest access authentication header.
using System;
using Cuemon.AspNetCore.Authentication.Digest;
namespace MyApp.Examples;
public static class DigestAuthorizationHeaderExample
{
public static void Demonstrate()
{
var header = new DigestAuthorizationHeader(
realm: "docs-example",
nonce: "abc123",
opaque: "opaque456",
algorithm: "SHA-256",
userName: "Agent",
uri: "/resource",
nc: "00000001",
cNonce: "client-nonce",
qop: "auth",
response: "deadbeef");
var parsed = DigestAuthorizationHeader.Create(header.ToString());
Console.WriteLine(parsed.UserName);
Console.WriteLine(parsed.Response);
}
}
Constructors
| Name | Description |
|---|---|
| DigestAuthorizationHeader(string, string, string, string, string, string, string, string, string, string) | Initializes a new instance of the DigestAuthorizationHeader class. |
Fields
| Name | Description |
|---|---|
| Scheme | The authentication scheme of the DigestAuthorizationHeader. |
Properties
| Name | Description |
|---|---|
| Algorithm | Gets the algorithm used to produce the digest and an unkeyed digest. |
| CNonce | Gets the unique client generated string. |
| NC | Gets the hexadecimal count of the number of requests the client has sent with the Nonce value. |
| Nonce | Gets the unique server generated string. |
| Opaque | Gets the string of data specified by the server. |
| Qop | Gets the "quality of protection" the client has applied to the message. |
| Realm | Gets the realm/credential scope that defines the remote resource. |
| Response | Gets the computed response which proves that the user knows a password. |
| Uri | Gets the effective request URI. |
| UserName | Gets the username of the specified Realm. |
Methods
| Name | Description |
|---|---|
| Create(string) | Creates an instance of DigestAuthorizationHeader from the specified parameters. |
| ParseCore(IReadOnlyDictionary<string, string>) | The core parser that resolves an AuthorizationHeader from a set of |
| ToString() | Returns a string that represents this instance. |