How to get your current Windows VPN authentication

I have a console application that calls a WCF service in a remote domain. WCF uses the Windows credential type for transport and message credential types.

The WCF service is configured to negotiate user credentials.

My question is, how can I get the authentication object that the WCF service is using on the client side?

For example, I went to the computer "LocalMachine\Garry". I connect to my VPN company with a domain name "MyCompany\Garry".

WCF is located in my company’s domain. When I execute the WCF service from my computer, based on the negotiation, the WCF service uses the identifier "MyCompany\Garry".

In the WCF service - Thread.CurrentPrincipal.Identity
 - returns "MyCompany\Garry".

In a console application, - Thread.CurrentPrincipal.Identity
 - returns "LocalMachine\Garry".

How can I get the VPN domain ID that is passed to the WCF service?

+3
source share

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


All Articles