title: Does WCF UserNamePasswordValidator require checking PrimaryIdentity.IsAuthenticated?
body: <p>Currently I have a service that uses a <code>UserNamePasswordValidator</code> to authenticate the client user. The code for the validation goes as follows:</p>
  
  <pre><code>  public override void Validate(String userName, String password)
    {
        if (userName == null) || (password == null)
            throw new FaultException("Username and/or password not specified.");
        if (userName != "test") &amp;&amp; (password != "tset")
            throw new FaultException("Invalid username and/or password.");
    }
  </code></pre>
  
  <p>As you can see, the code will always throw an exception when something is wrong.</p>
  
  <p>Now for the question - Is there any reason I should check whether <code>ServiceSecurityContext.Current.PrimaryIdentity.IsAuthenticated</code> is true inside my <code>OperationContract</code> functions? For example,</p>
  
  <pre><code>  public interface IMyService
    {
        [OperationContract]
        void myOpContract();
    }
  
    public class MyService : IMyService
    {
        public void myOpContract()
        {
            // Do I really need this conditional statement?
            if (ServiceSecurityContext.Current.PrimaryIdentity.IsAuthenticated)
                // Proceed as expected
            else
                // Fail?
        }
    }
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>