I am developing a WCF service. I want to authenticate my WCF service with a valid username and password without using any certificate. The username and password should only be supplied once not for every method.
I've implemented my custom userNamePasswordValidationMode in my WCF app like so:
public class UserValidator : UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
if (null == userName || null == password)
{
throw new ArgumentNullException();
}
if ((userName == null || password == null) ||
userName == "test" && password == "1234")
{
throw new FaultException("Unknown username or incorrect password.");
}
}
}
ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
sc.ClientCredentials.UserName.UserName = "test";
sc.ClientCredentials.UserName.Password = "1234";
But I read somewhere that in order to implement we require certificate. And we don't want to use that. Is there any work around for this. We don't want to use certificate and implement as above.