title: Authentication Service using WCF
body: <p>I have a custom MembershipProvider as shown below. It validate user name and password against Active Directory. I would like to make this as an “authentication service”. This should work even if the client uses forms authentication or windows authentication.</p>
  
  <p>There is a WCF “HR Service” which is providing employee information. The “HR UI” website is using “HR Service” WCF service. Now we need to ensure that any client using the “HR Service” should be authenticated using “authentication service” before accessing the operation of “HR Service”. If the client application is authenticated once, next time onwards it should not be validated again (till the application is closed). When a new instance of the client application is opened it need to be authenticated from beginning.</p>
  
  <p>How do we achive it? Do we have any code samples for the end to end flow demonstration?</p>
  
  <p>Note: I should be able to test it using <strong>self hosted</strong> services.</p>
  
  <p>Note: The client can be of any platform (e.g. Java).</p>
  
  <pre><code>namespace LijosCustomValidation
  {
  public sealed class LijoMembershipProvider : MembershipProvider
  {
  
      public override bool ValidateUser(string username, string password)
      {
          bool isValid = true;
   //my logic to validate the user name and password
          return isValid;
      }
  
     //other implementations of Abstract Methods from MembershipProvider
    }
  </code></pre>