Trying to obtain the Windows Identity of the Logged on User in AccountController

风流意气都作罢 提交于 2019-12-13 08:28:09

问题


using framework asp.net core - on .net core MVC jquery

In the account controller, I am attempting to obtain the user currently logged in to that machine on an intranet network. ie the windows authenticated user.

If I try WindowsIdentity.GetCurrent() is just returns the identity of the application pool. not what I need.

I have anonymous turned off and windows auth turned on in both the launchsettings.json and the IIS settings.

I understand that the identity middleware for abp framework I'm using is table based so the Controllers 'User' property is not what I need either.

I am wondering whether this is a limitation of the .net core?


回答1:


You need to disable Anonymous Authentication and enable Windows Authentication for a specific page like Login page. This way, you say the Login page requires NTLM. So browser sends authenticated user information. And you can retrieve it with HttpContext.User.Identity.Name

Then there's next challenge! Authenticating this user with ABP. For this one, you can check out this StackOverflow post.



来源:https://stackoverflow.com/questions/49545771/trying-to-obtain-the-windows-identity-of-the-logged-on-user-in-accountcontroller

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