mirror of
https://github.com/Readarr/Readarr
synced 2025-12-14 04:13:37 +01:00
Fixed: Calibre authentication with Basic auth
This commit is contained in:
parent
0bb391235f
commit
5d63ef01b6
2 changed files with 17 additions and 3 deletions
|
|
@ -823,7 +823,7 @@ public void should_reject_malformed_domain_cookie(string malformedCookie)
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void should_correctly_use_basic_auth()
|
||||
public void should_correctly_use_basic_auth_with_basic_network_credential()
|
||||
{
|
||||
var request = new HttpRequest($"https://{_httpBinHost}/basic-auth/username/password");
|
||||
request.Credentials = new BasicNetworkCredential("username", "password");
|
||||
|
|
@ -833,6 +833,17 @@ public void should_correctly_use_basic_auth()
|
|||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_correctly_use_basic_auth_with_network_credential()
|
||||
{
|
||||
var request = new HttpRequest($"https://{_httpBinHost}/basic-auth/username/password");
|
||||
request.Credentials = new NetworkCredential("username", "password");
|
||||
|
||||
var response = Subject.Execute(request);
|
||||
|
||||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_correctly_use_digest_auth()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -68,8 +68,11 @@ public HttpResponse GetResponse(HttpRequest request, CookieContainer cookies)
|
|||
else if (request.Credentials is NetworkCredential nc)
|
||||
{
|
||||
var creds = GetCredentialCache();
|
||||
creds.Remove((Uri)request.Url, "Digest");
|
||||
creds.Add((Uri)request.Url, "Digest", nc);
|
||||
foreach (var authtype in new[] { "Basic", "Digest" })
|
||||
{
|
||||
creds.Remove((Uri)request.Url, authtype);
|
||||
creds.Add((Uri)request.Url, authtype, nc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue