RestSharp.Authenticators.Digest
3.0.1-rc.6
dotnet add package RestSharp.Authenticators.Digest --version 3.0.1-rc.6
NuGet\Install-Package RestSharp.Authenticators.Digest -Version 3.0.1-rc.6
<PackageReference Include="RestSharp.Authenticators.Digest" Version="3.0.1-rc.6" />
<PackageVersion Include="RestSharp.Authenticators.Digest" Version="3.0.1-rc.6" />
<PackageReference Include="RestSharp.Authenticators.Digest" />
paket add RestSharp.Authenticators.Digest --version 3.0.1-rc.6
#r "nuget: RestSharp.Authenticators.Digest, 3.0.1-rc.6"
#:package RestSharp.Authenticators.Digest@3.0.1-rc.6
#addin nuget:?package=RestSharp.Authenticators.Digest&version=3.0.1-rc.6&prerelease
#tool nuget:?package=RestSharp.Authenticators.Digest&version=3.0.1-rc.6&prerelease
RestSharp.Authenticators.Digest
A lightweight and extensible Digest authentication plugin for RestSharp,
implemented as an IAuthenticator.
๐ฆ Installation
Install via NuGet:
dotnet add package RestSharp.Authenticators.Digest
โ Compatibility
- .NET Standard 2.0
- .NET Framework 4.7.1+ (limited by RestSharp 114.0.0)
- .NET Core 2.0+
- .NET 5, 6, 7, 8, 9, 10+
- Fully compatible with
RestClientfrom RestSharp
๐ Quick Usage
namespace Example
{
using RestSharp;
using RestSharp.Authenticators.Digest;
using System;
public class Program
{
public static void Main(string[] args)
{
var restOptions = new RestClientOptions("https://api.myhost.com/api/v1")
{
Authenticator = new DigestAuthenticator(USERNAME, PASSWORD)
};
var client = new RestClient(restOptions);
var request = new RestRequest("values", Method.GET);
request.AddHeader("Content-Type", "application/json");
var response = client.Execute(request);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Content);
Console.ReadKey(true);
}
}
}
โจ Features
- Implements HTTP Digest Authentication with support for both modern and legacy protocols:
- RFC 2617 / RFC 7616 โ Full digest authentication with
qop=auth,cnonce, and nonce counting - RFC 2069 โ Legacy digest authentication without
qop(for older servers)
- RFC 2617 / RFC 7616 โ Full digest authentication with
- Automatic protocol detection โ the library reads the server's
WWW-Authenticatechallenge and selects the correct hash format - Nonce, realm, opaque, and qop support
- Compatible with servers that require
WWW-Authenticate: Digest - Stateless and thread-safe
- Works with
RestClientandIRestRequestout of the box
๐ Protocol Support
The library automatically detects which protocol the server uses based on the WWW-Authenticate response header. No configuration is needed โ the same code works for both protocols.
RFC 2617 / RFC 7616 (modern servers)
When the server includes qop in its challenge (e.g., qop="auth" or qop="auth,auth-int"), the library uses the full digest scheme:
response = MD5(MD5(username:realm:password):nonce:nc:cnonce:qop:MD5(method:uri))
The generated Authorization header includes qop, nc, and cnonce fields.
RFC 2069 (legacy servers)
When the server does not include qop in its challenge, the library falls back to the simplified RFC 2069 scheme:
response = MD5(MD5(username:realm:password):nonce:MD5(method:uri))
The generated Authorization header omits qop, nc, and cnonce fields, as required by the legacy protocol.
Usage
The usage is identical for both protocols โ just create the authenticator and let the library handle the rest:
var restOptions = new RestClientOptions("https://api.myhost.com/api/v1")
{
Authenticator = new DigestAuthenticator("username", "password")
};
var client = new RestClient(restOptions);
var request = new RestRequest("resource");
var response = await client.ExecuteAsync(request);
This works transparently whether the server uses RFC 2069 or RFC 2617/7616.
๐งช Testing
The project includes comprehensive unit and integration tests covering both RFC 2069 and RFC 2617/7616 protocols.
Integration tests use embedded HTTP listeners that simulate digest servers for both protocols.
Tests target multiple frameworks (net8.0, net10.0).
๐ License
This project is licensed under the MIT License.
๐ค Contributing
Contributions are welcome!
If you find a bug or have an idea for improvement:
- Open an issue
- Or submit a pull request
Please follow the contribution guidelines if available.
๐ฌ Contact
Maintained by @thenoobsbr NuGet Package: RestSharp.Authenticators.Digest
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- RestSharp (>= 114.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on RestSharp.Authenticators.Digest:
| Package | Downloads |
|---|---|
|
SmartHomeClassLib
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.1-rc.6 | 28 | 4/7/2026 |
| 3.0.1-rc.5 | 29 | 4/7/2026 |
| 3.0.0 | 92 | 4/7/2026 |
| 3.0.0-rc.3 | 35 | 4/7/2026 |
| 2.1.0 | 12,201 | 6/19/2025 |
| 2.0.0 | 30,837 | 6/17/2024 |
| 1.6.0 | 66,220 | 8/4/2023 |
| 1.5.0 | 1,889 | 7/10/2023 |
| 1.4.0 | 1,268 | 7/10/2023 |
| 1.3.1 | 18,788 | 4/13/2022 |
| 1.3.0 | 5,829 | 2/2/2022 |
| 1.2.0 | 139,531 | 12/21/2021 |
| 1.1.0 | 5,290 | 11/29/2021 |
| 1.0.2 | 72,241 | 2/26/2020 |
| 1.0.1 | 2,548 | 9/17/2019 |
| 1.0.0 | 1,546 | 8/23/2019 |
# Release notes
## v3.0.0
- Updates RestSharp dependency to version 114.0.0;
- Adds CancellationToken support to the Authenticate method (IAuthenticator breaking change in RestSharp 114);
- Threads CancellationToken through the digest handshake pipeline;
- Adds backward compatibility layer (DigestAuthenticatorLegacy) for consumers upgrading from v2.x;
- Drops net6.0 test target (EOL);
- Adds comprehensive unit tests for DigestAuthenticator, DigestHeader, DigestAuthenticatorManager, and
DigestAuthenticatorLegacy;
- Adds integration tests for error scenarios, wrong credentials, multiple HTTP methods, and concurrent requests;
## v1.4.0
- Fixies the authentication when the qop value comes without `"`;
- Updates packages;
- Adds a real integration tests;
## v1.5.0
- Adjusts the nuget package;
- Adds optional ILogger to the DigestAuthenticator constructor;
- Adds optional request timeout to the DigestAuthenticator constructor;
## v1.6.0
- GetDigestAuthHeader should inherit proxy;
## v2.0.0
- Changes the compatibility to the RestSharp version `111.2.0` or greater.
## v2.1.0
- Add ability to change client options from digest RestClient object