title: RESTful user authentication service
body: <p>Hey folks,  this seems to have been discussion fairly often but I want to make a simple, watered down question around doing authentication with RESTful services.  The scenario is as follows:  </p>
  
  <ul>
  <li>There is a system that houses registered users for an application.  The system exposes a RESTful API for accessing these users.  </li>
  <li>There is a front-end application that has a login form.  The application can either be internal, or external.</li>
  <li>The front-end application needs to use the data in the User system to authenticate a user.</li>
  </ul>
  
  <p>The question now is how to authenticate a user whose credentials (username/password) are entered in the client application against the data in the User system such that it is secure and performant?  For the sake of this question, suppose the client application is internal to some sort of Intranet but the applications will not reside on the same machine and may only communicate through the service.</p>
  
  <p>I understand the idea of having the application being "hypermedia driven" but we should be able to provide filtering/searching services.  For example, consider the resources and API as below:</p>
  
  <ul>
  <li><a href="http://example.com/users" rel="noreferrer">http://example.com/users</a>  
  
  <ul>
  <li>GET - retrieves all users (paged, hypermedia driven)  </li>
  <li>POST - creates new user</li>
  <li>PUT/DELETE not supported</li>
  </ul></li>
  <li><a href="http://example.com/users/[id]" rel="noreferrer">http://example.com/users/[id]</a>
  
  <ul>
  <li>GET - returns a full representation of a user with id = {id}</li>
  <li>PUT - updates user, takes in any predefined media type</li>
  <li>DELETE - deletes the user (with appropriate authorization)</li>
  <li>POST not supported</li>
  </ul></li>
  </ul>
  
  <p>Based on the above, my idea would be have the client application GET on the user listing, filtering by username.  The service will return the hashed password and salt to the client, the client will perform the authentication.</p>
  
  <p>Thoughts?</p>