Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Security REST and Angular

I have a full Spring application (security managed by spring-security and the controller Layer is build with Spring MVC).

I am using in the front-end AngularJS .

I need some example of how I will handle REST authentication with Spring Security and how I will call these services in the Angular side.

Note: Basic authentication will be perfect in my case .

like image 401
Nabil Avatar asked Oct 02 '13 00:10

Nabil


2 Answers

Some code is needed to integrate AngularJS and Spring Security, as Spring Security wasn't meant to be used by a full Ajax framework.

Here is a sample application that does this integration, you will get both the Spring Security configuration and some classes used to do this integration:

https://github.com/jhipster/jhipster-sample-app

like image 110
Julien Dubois Avatar answered Nov 16 '22 00:11

Julien Dubois


One of the great things about AngularJS is that its pretty flexible and can operate with a number of different backend configurations. While I haven't personally used spring MVC or spring security I have used Angular with .NET MVC, Node, and PHP all with slightly different authentication systems and it worked out very well.

Dave Mosher has a great tutorial series that incorporates authentication concepts(his example is PHP with Laravel) but the concepts may be helpful: https://github.com/davemo/end-to-end-with-angularjs

For a more advanced example of authentication with AngularJS you might want to check out Angular-App: https://github.com/angular-app/angular-app

like image 35
TyndieRock Avatar answered Nov 16 '22 00:11

TyndieRock