I'm using spring security 4.0.1 inside a spring boot 1.2.3 web application ( and also with spring-session 1.0.1, but this is irrelevant for the case ).
I do have a private area, and an all access area ( "/about", "/","/contact",... more than 20 pages ) for which every user can access. ( it's like a web-shop )
Whenever a logged-in user session expires,Spring detects an invalid session and redirects the user to the '.invalidSessionUrl("/session/error/invalid")'
However, i only want to be redirected if the target link in inside the private area, nor the public one.
How can i avoid that ?
Thanks.
This is my (java) config : ( updated after seen post )
http
.authorizeRequests()
.anyRequest()
.permitAll()
.antMatchers("/privado/**")
.authenticated()
.and()
.formLogin()
.loginPage("/login")
.failureUrl("/login?error")
.defaultSuccessUrl("/")
.successHandler(new SessionSuccessHandler())
.and()
.logout()
.logoutSuccessUrl("/")
.deleteCookies("JSESSIONID", "SESSION")
.and()
.sessionManagement()
.invalidSessionUrl("/session/error/invalid")
.sessionFixation()
.changeSessionId()
.maximumSessions(1)
.expiredUrl("/session/error/expired")
.and()
.and()
.csrf()
.ignoringAntMatchers("/jolokia/**", "/v1.0/**");
How can i achieve that ?
Thanks a lot.