title: How to add security to spring based rest api's and static content
body: <p>I have a web application + a set of rest APIs created with spring. It is essentially some html pages sending ajax requests to the rest server.  The structure looks somewhat like this:  </p>
  
  <p>myWebapp -> src/main/webapp/public (public pages)<br>
  myWebapp -> src/main/webapp/resources (non - public pages, available only after login)</p>
  
  <p>I need to secure some of the static content (non-public above) and the rest APIs (Preferably with LDAP, but that's not important). How do i configure the filters and/or spring security intercepts so that:</p>
  
  <ol>
  <li>Same credentials work for both static content and rest calls.</li>
  <li>User can login via a login page, and for further rest calls uses some token or something returned from server.</li>
  </ol>
  
  <p>I have checked spring security schemes for rest API's and also found some resources on securing static content, but not able to figure out how to fit this together as above.</p>