如何在 Windows 表单应用程序中获取 VPN 用户的当前用户身份?

发布于 2024-07-26 00:04:27 字数 257 浏览 2 评论 0原文

我们目前正在开发一个 Windows 智能客户端,需要使用 AD 组成员身份对用户进行身份验证。

我们现在要求某些用户通过 VPN 进行连接。 有什么方法可以从 VPN 登录中获取 AD 帐户身份和组吗?

WindowsIdentity.GetCurrent() 返回本地用户帐户而不是其 VPN 帐户信息。

本地帐户名称与用于 VPN 连接的 AD 帐户名称不同。 即用户在其家用 PC 上,并使用其工作 AD 帐户连接到办公室。

We're currently developing a Windows Smartclient that needs to authenticate users using their AD group membership.

We now have a requirement for some users to connect over VPN. Is there any way I can get the AD account identity and groups from the VPN login?

WindowsIdentity.GetCurrent() returns the local user account rather than their VPN account information.

The local account name is different that the AD account used for the VPN connection. i.e the user is on their home PC, and connecting to the office using their work AD account.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我的影子我的梦 2024-08-02 00:04:27

如果他们的计算机位于域中并且他们使用 AD 凭据登录,那么就可以了。 WindowsIdentity.GetCurrent() 将正确返回。 如果您通过 VPN 进入网络但未进入 AD,那么您就不走运了。 尝试以 AD 帐户运行您的程序。 如果您在“运行方式”对话框中正确进行身份验证,WindowsIdentity.GetCurrent() 应该是正确的。

If their computer is on the domain and they log in under their AD credentials, you're good. WindowsIdentity.GetCurrent() will return correctly. If you VPN into the network but not into AD, you're out of luck. Try running your program as the AD Account. If you authenticate properly in the "Run As" dialog, WindowsIdentity.GetCurrent() should be correct.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文