title: How to implement basic Spring security (session management) for Single Page AngularJS application
body: <p>I am currently building a single page AngularJS application which communicates via REST to a backend. The structure is as follow:</p>
  
  <p>One Spring MVC WebApp project which contains all AngularJS pages and resources and all REST controllers.</p>
  
  <p>A true backend which has services and repositories for backend communication, an API if you will. The REST calls will talk to these service (the second project is included as a dependency of the first one).</p>
  
  <p>I have been thinking about this a lot but I can't seem to find anything that can help me. Basically I just need some security on this application. I'd like some kind of session management which is extremely simple:</p>
  
  <ul>
  <li>user logs in, session id is created and stored in JS/cookie on
  website</li>
  <li>when user would reload page/ come back later a check needs to be done to see if the session id is still valid</li>
  <li>no calls should reach the controllers if the session id is not valid</li>
  </ul>
  
  <p>This is the general idea of basic session managament, what would be the easiest way to get this implemented in a Spring MVC webapp (no JSP's, just angular and REST controllers).</p>
  
  <p>Thanks in advance!</p>