A lightweight and extensible Digest authentication plugin for RestSharp,
implemented as an IAuthenticator
.
Install via NuGet:
dotnet add package RestSharp.Authenticators.Digest
- .NET Standard 2.0
- .NET Core 3.1+
- .NET 5, 6, 7, 8, 9+
- Fully compatible with
RestClient
from RestSharp
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);
}
}
}
- Implements HTTP Digest Authentication (RFC 7616)
- Nonce and realm support
- Compatible with servers that require
WWW-Authenticate: Digest
- Stateless and thread-safe
- Works with
RestClient
andIRestRequest
out of the box
Digest-authenticated servers can be mocked for integration testing using test frameworks or by hitting known Digest-protected endpoints.
Tests for multiple target frameworks (net6.0
, net8.0
, net9.0
) are included.
This project is licensed under the MIT License.
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.
Maintained by @thenoobsbr NuGet Package: RestSharp.Authenticators.Digest