java - Do applications with spring security share SecurityContextHolder among them -


i have 2 different applications, a , . both using spring security same configuration. here situation:

i log a application. works fine. when log b application (it has same ip different port) in tab in same browser, see these lines (below) , thrown away a application, means no longer authenticated in it.

debug 2013-05-20 13:42:43,969 [http-8080-2] org.springframework.security.web.filterchainproxy$virtualfilterchain : /webapp/backoffice/index.jsp @ position 2 of 12 in additional filter chain; firing filter: 'securitycontextpersistencefilter'

debug 2013-05-20 13:42:43,969 [http-8080-2] org.springframework.security.web.context.httpsessionsecuritycontextrepository : no httpsession exists

debug 2013-05-20 13:42:43,969 [http-8080-2] org.springframework.security.web.context.httpsessionsecuritycontextrepository : no securitycontext available httpsession: null. new 1 created.

  1. i using httpsessionsecuritycontextrepository securitycontextrepository.
  2. i have enabled sessionmigration security purposes.
  3. i using concurrentsessionfilter, prevent being logged in via 2 or more devices.

but not getting why logging in b application, removes httpsession a application? (or maybe other things happening)

i want know whether these applications, share in common within browser.


asked ip/port, should know ips same (both localhost) have different ports.
a) localhost:8080/dtts/backoffice
b) localhost:8081/dtts/backoffice
solved
problem every url/path there unique jsessionid. both of applications use url:localhost , path:dtts. that's why second jsessionid replaces first one.

the cookie application b overwriting cookie stored in browser application a, because both cookies same server i.e. 'localhost', , both cookies have name, i.e. 'jsessionid'.

cookies not port specific. discussed in question: are http cookies port specific?

i believe options are:

  • use different ip or server name access each application (e.g. localhost , 127.0.0.1, or applicationa.mydomain.com , applicationb.mydomain.com)
  • use different name session cookie in container each application running in

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -