How do I get the Current User identity for a VPN user in a Windows forms app?

南笙酒味 提交于 2019-12-17 16:49:08

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/1043436/how-do-i-get-the-current-user-identity-for-a-vpn-user-in-a-windows-forms-app

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