Question on Stackoverflow: https://stackoverflow.com/questions/45684877/unable-to-get-authenticationtype-in-asp-net-core-web-api
I'm writing a simple ASP.NET Core Web API that needs to return "true" if the authentication type of the logged in user is "Kerberos", and "false" otherwise. The code that works is:
publicIEnumerable<string>Get(){if(User?.Identity?.IsAuthenticated==true){returnnewString[]{"true"};}returnnewString[]{"false"};}
However, if I change the "IsAuthenticated" to "AuthenticationType" and check for the string value "Kerberos" as follows:
publicIEnumerable<string>Get(){if(User?.Identity?.AuthenticationType=="Kerberos"){returnnewString[]{"true"};}returnnewString[]{"false"};}
Then it starts throwing an error 500 if I run it on a Windows Server 2012 R2 based IIS Server. If I run it within Visual Studio (on the localhost - a domain-joined Windows 10 machine), it produces the right result.
What am I doing wrong?