title: Spring Security Token Authentication - RESTful JSON Service
body: <p>I'm looking to use Spring Security for a Spring MVC application which will strictly be a JSON web service. I've done some research and read a few articles but haven't really found anything complete. I want the application to be completely stateless and use token based authentication. I don't want the Spring MVC application to have any forms, or used forms to authenticate. It should strictly take requests and data in JSON, and return JSON responses.</p>
  
  <p>There will be an Angular JS client application which will need to send the username and password and get the token from the application to be used in sequential requests. At some point there may be Android clients that access this web service as well.</p>
  
  <p>I'm assuming Spring Security has its way internally to mapping a token to a user session, meaning it knows token XXXXXXXXXXXX is admin user Bob and token AAAAAAAAAA is standard user Joe. However I don't have much experience with Spring Security so I don't know how this all comes together. I still want to be able to use secured annotations on controller and service methods.</p>
  
  <p>Is there a way to accomplish this in Spring Security?</p>
  
  <p>This question seems to be a good place to start but I'm not sure this will work as I envisioned it <a href="https://stackoverflow.com/questions/10826293/restful-authentication-via-spring">RESTful Authentication via Spring</a>. </p>