I'm facing an issue with Windows Authentication when deploying my Single Sign-On (SSO) application using Duende SSO on IIS. The application is secured using an SSL certificate with the following subject alternative names:
- mymachine
- mymachine.home
In IIS, I have configured the following bindings for my SSO:
- https://mymachine.home:5007
- https://mymachine:5007
Problem: When I send an authentication request to https://mymachine.home:5007, the method GetWindowsPrincipal() returns an authenticationType of "" (empty string), which causes the authentication to fail.
However, when I send the request to https://mymachine:5007, the method returns authenticationType = "Negotiate", and the authentication process works as expected using NTLM.
Here’s the code for the GetWindowsPrincipal() method:
Copy code
private WindowsPrincipal? GetWindowsPrincipal()
{
NativeMethods.HttpGetAuthenticationInformation(_requestNativeHandle, out var authenticationType, out var token);
if (token != IntPtr.Zero && authenticationType != null)
{
if ((authenticationType.Equals(NtlmString, StringComparison.OrdinalIgnoreCase)
|| authenticationType.Equals(NegotiateString, StringComparison.OrdinalIgnoreCase)
|| authenticationType.Equals(BasicString, StringComparison.OrdinalIgnoreCase)))
{
return new WindowsPrincipal(new WindowsIdentity(token, authenticationType));
}
}
return null;
}
Question: Why does the authenticationType return an empty string when using the https://mymachine.home:5007 binding, and how can I resolve this issue to ensure that the authentication works for both bindings?
I've ensured that the SSL certificate is correctly configured and includes both mymachine and mymachine.home as subject alternative names. Is there a specific IIS setting or additional configuration required to handle this scenario?