0

I have a web app that calls a WCF web application with several services, all using basicHttBinding, on different servers (web server, app server and database server). One of the services has to connect to a database that must be called using an active directory account. Coming in from the web site the user is anonymous.

I have been given credentials to set this user to but I cannot get it to work. I create my channel on the web server like this:

ChannelFactory<T> channelFactory = GetChannelFactoryFromPool<T>(enpointAddress);       
channelFactory.Credentials.Windows.ClientCredential.UserName = username;
channelFactory.Credentials.Windows.ClientCredential.Password = password;
channelFactory.Credentials.Windows.ClientCredential.Domain = domain;
proxy = channelFactory.CreateChannel();

In the service on the app server I am trying to determine if the credentials are correct by doing this:

var ssc = ServiceSecurityContext.Current;

but ssc is always null. Can this be done with basicHttpBinding?

Thanks, Paul

Paul Speranza
  • 2,302
  • 8
  • 26
  • 43

1 Answers1

2

The basicHttpBinding does support Windows authentication as documented in this good MSDN article. You also need to ensure the service operations are configured to allow impersonation of the client credentials to have the security context populated as expected.

Sixto Saez
  • 12,610
  • 5
  • 43
  • 51