Modules Integration and Security in spring

1.6k views Asked by At

I have several multi module spring web application each application like below, each of them differently develop no inter - connection.

war
|...webModule    
|...coreModule 

I want to integrate them with one admin module with security settings. How can i do that?? is their any frameworks for that??

I go through the OSGI approach but it has lot migration work. What about component based (I never do that)... Can any one suggest some way to create my integration application which can handle common login & security for other sub application ? (need single sign on multiple war solution)

1

There are 1 answers

1
Master Slave On

I strongly advise reading up on the Angular JS and Spring Security series, especially related is the https://spring.io/blog/2015/01/20/the-resource-server-angular-js-and-spring-security-part-iii

The approach that they describe seems completly viable for you. Key points

  • Spring Security uses the HttpSession to store authentication data by default. It doesn’t interact directly with the session though: there’s an abstraction layer (SecurityContextRepository) in between that you can use to change the storage backend.

  • After authenticating through your admin module you should store your authentication data into a storage accessible to all your other modules, and using a session id as a key for the data. You can easily achieve this with a help of Spring Session where you can use an out-of-the-box supported Redis as your shared storage for authentication data.

  • Finally, the key will be set inside a custom header of the requests that target other modules, which will use this custom header and a changed session strategy to pull the authentication data from the storage and authenticated the user

There are quite a few details behind the approach, but the series come with the sample implementation so you should be able to find your way