In order to setup the WCF web service to consume the user name and password in a user validator you need to setup the service behavior like below:
<behaviors>
<endpointBehaviors>
<behavior name="webHttpBehavior">
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentSessions="2147483647"
maxConcurrentInstances="2147483647" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="FullyQaulifiedNameSpace.UserValidatorClass, FullyQaulifiedNameSpace" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
The User Name Authenticator (UserValidatorClass) will reside on the web project, but can call code from another referenced assembly. The UserValidator code will look like below:
using System.IdentityModel.Selectors;
namespace MyNameSpace.Web
{
public class UserValidator : UserNamePasswordValidator
{
public UserValidator() : base()
{
}
public override void Validate(string username, string password)
{
}
}
}
The easiest way to step into the Validate method is to publish your web service to IIS, and attach to the worker process for the app pool assigned to your web service.