I am writing a quite simple WCF-service with username/password authentication. My code for the username/password validator looks like this:
public class InvoiceServiceUserValidation : UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password))
{
throw new SecurityTokenException("Username and password required");
}
if (InvoiceServiceHelper.AuthenticateUser(userName, password)) return;
throw new FaultException("Could not authenticate - Unknown reason");
}
}
If I supply the correct username and password, everything is fine, and the operations continue. When I supply the wrong password, hovever, the exception is never returned, so my client just stays there waiting before it times out.
I have debugged so I know the line with "throw new FaultException" is actually reached when it is wrong, but still no answer to the client.
Help would be greatly appreciated