Impersonate a domain account outside the domain

I have a one-time application that uses Windows Auth to authenticate with WCF services. However, I am trying to allow users to run this application at home through a VPN connection. The main problem here is that DefaultNetworkCredentials are not configured correctly.

I was hoping to determine if the user is connected to AD using

WindowsIdentity.GetCurrent().Name.StartsWith(@"{DOMAIN NAME}\", StringComparison.InvariantCultureIgnoreCase) 

But after that, I canโ€™t understand how to impersonate a domain user while on a home machine ...

+4
source share
1 answer

I think you need to do this at the user level,

C: \ Windows \ System32 \ runas.exe / netonly / user: \ "YOURAPPPATH"

Try to run this application from the command line. (Or, perhaps with installation, include a shortcut that looks like this)

They will have to re-enter the domain password each time they start.

Here is more information about runas here.

+2
source

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


All Articles