Consider a WCF service using WsHttpBinding
for which only the domain users are allowed to call this service.
How can you find the Active Directory username of the caller?
Get the value of System.ServiceModel.ServiceSecurityContext.Current.WindowsIdentity.Name
property.
It does not matter which binding you use as long as the security mode is different from None
for the binding.
If the security mode is None
then System.ServiceModel.ServiceSecurityContext.Current
will be null
.