尝试获取AccountController中登录用户的Windows身份

编程入门 行业动态 更新时间:2024-10-24 16:33:03
本文介绍了尝试获取AccountController中登录用户的Windows身份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使用框架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身份

本文发布于:2023-11-06 06:59:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1563005.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:身份   用户   AccountController   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!