0

Is there a way to cancel the creation of the session if the method with the IsInitiating causes a validation error?

I am requiring the user and password in the first method and I do not want to create the session if the credentials are not valid. In fact, I want to return an object indicating if the credentials validation were successful.

Thank you in advance.

Juan Simon
  • 178
  • 9

1 Answers1

0
public override void Validate(string userName, string password)
{
    if (!(userName == "test1" && password == "1tset"))
    {
        throw new FaultException("Unknown Username or Incorrect Password");
        // or
        // throw new SecurityTokenException("Unknown Username or Incorrect Password");
    }
}

For more information see: https://msdn.microsoft.com/en-us/library/aa702565%28v=vs.110%29.aspx

George Mamaladze
  • 7,593
  • 2
  • 36
  • 52