Digest authentication in ASP.NET Core / Kestrel
Asked Answered
L

3

12

Is it possible to use digest authentication in ASP.NET Core / Kestrel? If it is, how do I enable and use it?

I know that basic authentication is not and will not be implemented because it's considered insecure and slow, but I can't find anything at all about digest.

I don't want to use IIS' authentication because I don't want to be tied to Windows accounts, I want use a custom credentials validation logic.

Liszt answered 20/10, 2016 at 16:21 Comment(0)
S
5

The only implementation of digest auth currently available with Core is the one in IIS that's tied to integrated windows auth.

System answered 23/10, 2016 at 2:48 Comment(0)
F
0

If someone is looking for the answer. This code is working for me:

using System.ServiceModel;

var binding = new BasicHttpBinding();
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Digest;
binding.TextEncoding = Encoding.UTF8;
binding.TransferMode = TransferMode.Buffered;
binding.AllowCookies = false;
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;

var endpoint = new EndpointAddress(new Uri("http://website.domain/WebService.svc"));
var client = new MessageServiceClient(binding, endpoint);
client.ClientCredentials.HttpDigest.ClientCredential.UserName = "username";
client.ClientCredentials.HttpDigest.ClientCredential.Password = "password";

var response = client.CallMethod();
Frogmouth answered 17/12, 2018 at 13:56 Comment(1)
How to use it in ASP.NET Core?Ixion
A
-4

Few thing about Kestrel, WebListener servers and authentication

And example how you can allow anonymous users using WebListener:

builder.UseWebListener(options =>
{    
     options.Listener.AuthenticationManager.AuthenticationSchemes = AuthenticationSchemes.AllowAnonymous;
});
Admit answered 20/10, 2016 at 19:53 Comment(1)
I'm not asking for Integrated Windows Authentication, what I'm looking for is digest access authentication.Liszt

© 2022 - 2024 — McMap. All rights reserved.