尝试获取AccountController中登录用户的Windows身份 [英] Trying to obtain the Windows Identity of the Logged on User in AccountController

查看:143
本文介绍了尝试获取AccountController中登录用户的Windows身份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用框架asp.net核心-在.net核心MVC jquery上

using framework asp.net core - on .net 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.

我想知道这是否是.net核心的限制吗?

I am wondering whether this is a limitation of the .net 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身份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆