I need to have web application which actually consist from few separate wars unified into same navigration bar on UI, i need to have all system secured but have authentication only to main web application and after automatic propagation of this security context to sub web applications. I'm using spring security, could someone help me with advice? thanks
相关问题
- java.lang.IllegalArgumentException: Cannot set to
- “Zero out” sensitive String data in Swift
- Spring Data MongoDB - lazy access to some fields
- Declaring an explict object dependency in Spring
- Decoding body parameters with Spring
This can be achieved by following approach. In Spring,
SecurityContext
by default is stored inHttpSession
. Instead you can configure it to store in some shared repository.So, configuration should be changed to use your own
SecurityContextRepository
implementation instead ofHttpSessionSecurityContextRepository
. Once configured, the security framework will look at theRepository
which is available to all your web applications.The
Repository
can be either a database or a cached server.Spring Security stores the login data in the http session. So what I would try is to share the session between the applications.
It seams that this is possible (in Tomcat) by using the Single Sing On attribute.
But be warned, sharing the session between two applications is not without danger. See this Stack Overflow question.