Redirection sur l'url initiale après authentification par formulaire suite à expiration de session
Bonjour,
J'ai une webapp avec Spring Security 4.1.0 et Spring Framework 4.1.7
Après l'expiration de ma session, je clique sur une url lambda, le framework m’envoie vers le formulaire d'authentification comme prévu.
Après authentification, je souhaiterais être redirigé vers l'url lambda au lieux d'être redirigé vers l'url définie dans le fichier de conf spring. J'utilise un success handler spécifique qui hérite de SavedRequestAwareAuthenticationSuccessHandler (le handler qui sert justement à garder la requête d'origine). Mais malheureusement, je suis toujours redirigé vers l'url définie dans le fichier de conf spring. Que faut-il faire pour être redirigé vers l'url lambda après l'authentification ?
Ci dessous, ma conf Spring:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
.....
<security:http use-expressions="true">
<security:intercept-url pattern="/private/**" access="isAuthenticated()" />
<security:intercept-url pattern="/private/**" requires-channel="http" access="hasAnyRole('ROLE_ROOT','ROLE_ADMIN','ROLE_USER')" />
<security:intercept-url pattern="/private/admin/**" access="hasRole('ROLE_ROOT','ROLE_ADMIN')" requires-channel="http"/>
<security:session-management session-fixation-protection="migrateSession" invalid-session-url="/public/login" session-authentication-error-url="/public/login">
<security:concurrency-control max-sessions="1" error-if-maximum-exceeded="false" />
</security:session-management>
<security:logout logout-url="/private/logout" invalidate-session="false" success-handler-ref="customLogoutSuccessHandler" delete-cookies="JSESSIONID"/>
<security:csrf disabled="true"/>
<security:form-login login-page="/public/login" default-target-url="/private/home" always-use-default-target="false" authentication-failure-url="/public/login/error/invalidAuthentication" authentication-success-handler-ref="customAuthenticationSuccessHandler" />
<security:remember-me key="scoreone" token-validity-seconds="1209600" remember-me-parameter="remember-me" />
<security:request-cache ref="requestCache"/>
<security:access-denied-handler error-page="/denied"/>
</security:http>
<bean id="customAuthenticationSuccessHandler" class="monorg.web.handler.CustomAuthenticationSuccessHandler">
<property name="defaultTargetUrl" value="/private/home" />
<property name="alwaysUseDefaultTargetUrl" value="false" />
<property name="firstAuthenticationUrl" value="/private/usr/passwd" />
</bean>
.... |