Reputation: 113
I have bearer authentication in my asp.net core app. I need support the domain auth with IIS: user request myapp.com/auth/windows
. Response is {token: token_based_windows_loginname}
.
How to get loginname from IIS without windows authentication in my app?
Upvotes: 1
Views: 2255
Reputation: 2743
In your IIS web.config, you set forwardWindowsAuthToken="true"
and then you'll be able to get the authentication in your code HttpContext.User.Identities.FirstOrDefault(id => id.GetType() == typeof(WindowsIdentity));
This way, you don't have to change your code much, IIS will take care of passing the windows authentication to your app.
Might be helpful to you: Aspnet Core 1.1 Missing Windows Authentication when published
Upvotes: 1