How to get current user id for VPN user in windows forms application?

We are currently developing a Windows Smartclient that should authenticate users using their AD membership.

Now we have a requirement for some users to connect via VPN. Is there a way to get the AD account and group ID from the VPN login?

WindowsIdentity.GetCurrent () returns the local user account, not information about its VPN account.

The local account name is different from the AD account used to connect the VPN. that is, the user is on his home PC and connects to the office using his AD account.

+4
source share
1 answer

If their computer is in a domain and they log in under their AD credentials, you are fine. WindowsIdentity.GetCurrent() will return correctly. If you use a VPN on a network but not in AD, you're out of luck. Try running your program as an AD account. If you authenticate correctly in the Run As dialog box, WindowsIdentity.GetCurrent() must be correct.

+4
source

Source: https://habr.com/ru/post/1286743/


All Articles