Spring Security - Is SavedRequestAwareAuthenticationSuccessHandler broke? -
tldr: spring destroying current http session when redirecting login page; destroys ability navigate defaultsavedrequest after login. why happening?
details - maintaining legacy spring application:
- spring core version 3.1.0
- spring security version 3.1.0
when trying utilize savedrequestawareauthenticationsuccesshandler in login configuration, not working. here seems happening:
- http secured resource:
http://localhost:8080/myapp/viewworkorder?workordernumber=315261 spring correctly determines not logged in , saves request:
debug o.s.s.w.s.httpsessionrequestcache - defaultsavedrequest added session: defaultsavedrequest[http://localhost:8080/myapp/viewworkorder?workordernumber=315261]spring correctly redirects login page:
debug o.s.security.web.filterchainproxy - /login.jsp @ position 1 of 9 in additional filter chain; firing filter: 'channelprocessingfilter'spring destroys current session destroys ability later use defaultsavedrequest:
debug o.s.s.w.s.httpsessioneventpublisher - publishing event: org.springframework.security.web.session.httpsessiondestroyedevent[source=org.apache.catalina.session.standardsessionfacade@b25f027]
why or causing current session destroyed?
here pertinent configuration details:
<bean id="savedrequestawareauthenticationsuccesshandler" class="org.springframework.security.web.authentication.savedrequestawareauthenticationsuccesshandler"> <property name="defaulttargeturl" value="/postlogin" /> <property name="targeturlparameter" value="targeturl" /> <property name="alwaysusedefaulttargeturl" value="false" /> </bean> <security:http auto-config="false"> <!-- override default login , logout pages --> <security:form-login login-page="/login.jsp" login-processing-url="/j_spring_security_check" authentication-failure-url="/login.jsp?login_error=1" authentication-success-handler-ref="savedrequestawareauthenticationsuccesshandler" /> <security:session-management session-fixation-protection="none"/> - note inclusion of
session-managementnot seem affect feature either way.
well, embarrassing in interest of being citizen on stack overflow thought share found.
after setting breakpoint in spring httpsessioneventpublisher see if stack might give me clue, did. here screenshot: 
you'll notice login.jsp on stack. being new particular application, hadn't suspected jsp here found:
obviously, removing scriptlet solved issue. wonder why did , broke in process :)

Comments
Post a Comment