0

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.

PamZy
  • 123
  • 1
  • 14
  • What is your exact question? Show us what you have tried and explain what did not work as expected. – nodots Apr 06 '15 at 15:43
  • I'm in a similar position. I feel your pain. WCF has a pretty steep learning curve, especially when you're not interested in investing a large amount of time becoming an expert. You just want to build a quick service as part of a non-soa app. – Craig Celeste Jun 18 '15 at 15:22

0 Answers0