ASP .NET Core IIS Hosting user identity name is empty and IsAuthenticated=false

≯℡__Kan透↙ 提交于 2019-12-05 08:14:22

I solved the problem. This how I debugged it:

Since I was not sure if the user credentials are passed from the IIS, I decided to print out Request HTTP headers from the code to log file. The answer was there. I figured out that the IIS works with Basic Authentication.

It seems that Basic authentication is not supported in AspNetCore, so I added a middleware implementation that parse the information from the 'Authorization' header and create new user identity from it.

I made my own implementation but the following articles helped me a lot:

https://blog.dangl.me/archive/http-basic-authentication-in-aspnet-core-projects/

https://docs.microsoft.com/en-us/aspnet/core/fundamentals/middleware

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!