vendredi 8 mai 2015

How to implement basic Spring security (session management) for Single Page AngularJS application

I am currently building a single page AngularJS application which communicates via REST to a backend. The structure is as follow:

One Spring MVC WebApp project which contains all AngularJS pages and resources and all REST controllers.

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).

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:

  • user logs in, session id is created and stored in JS/cookie on website
  • when user would reload page/ come back later a check needs to be done to see if the session id is still valid
  • no calls should reach the controllers if the session id is not valid

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).

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire