A quick find (why I didn’t see it, if earlier ...), the link I provided in the question pointed to another sample at http://msdn.microsoft.com/en-us/library/aa702565.aspx
It is slightly different from the first sample and has a comment about using a FaultException instead of a SecurityTokenException if you want to provide information about the message.
public override void Validate(string userName, string password)
{
if (null == userName || null == password)
{
throw new ArgumentNullException();
}
if (!(userName == "test1" && password == "1tset") && !(userName == "test2" && password == "2tset"))
{
throw new FaultException("Unknown Username or Incorrect Password");
}
}
The client exception thrown now contains an internal exception of type FaultException with the text message I want to open.
source
share