使用框架asp核心-在核心MVC jquery上
using framework asp core - on core MVC jquery
在帐户控制器中,我试图获取当前登录到Intranet网络上该计算机的用户.即Windows身份验证的用户.
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.
如果我尝试WindowsIdentity.GetCurrent()只是返回应用程序池的标识.不是我所需要的.
If I try WindowsIdentity.GetCurrent() is just returns the identity of the application pool. not what I need.
在launchsettings.json和IIS设置中,我都关闭了匿名功能,并打开了Windows身份验证.
I have anonymous turned off and windows auth turned on in both the launchsettings.json and the IIS settings.
我知道我正在使用的abp框架的身份中间件是基于表的,因此Controllers 'User'属性也不是我所需要的.
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 core?
推荐答案您需要禁用匿名身份验证,并为登录之类的特定页面启用 Windows身份验证 页面.这样,您说登录"页面需要NTLM.因此,浏览器发送经过身份验证的用户信息.您可以使用HttpContext.User.Identity.Name
然后是下一个挑战!使用ABP验证此用户.为此,您可以查看此StackOverflow帖子.
Then there's next challenge! Authenticating this user with ABP. For this one, you can check out this StackOverflow post.
更多推荐
尝试获取AccountController中登录用户的Windows身份
发布评论