|
@@ -32,6 +32,7 @@ import org.springframework.security.web.authentication.SavedRequestAwareAuthenti
|
|
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
|
|
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
|
|
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
|
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
|
import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy;
|
|
import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy;
|
|
|
|
+import org.springframework.security.web.savedrequest.RequestCache;
|
|
import org.springframework.security.web.util.matcher.AndRequestMatcher;
|
|
import org.springframework.security.web.util.matcher.AndRequestMatcher;
|
|
import org.springframework.security.web.util.matcher.MediaTypeRequestMatcher;
|
|
import org.springframework.security.web.util.matcher.MediaTypeRequestMatcher;
|
|
import org.springframework.security.web.util.matcher.NegatedRequestMatcher;
|
|
import org.springframework.security.web.util.matcher.NegatedRequestMatcher;
|
|
@@ -65,7 +66,8 @@ public abstract class AbstractAuthenticationFilterConfigurer<B extends HttpSecur
|
|
|
|
|
|
private AuthenticationDetailsSource<HttpServletRequest, ?> authenticationDetailsSource;
|
|
private AuthenticationDetailsSource<HttpServletRequest, ?> authenticationDetailsSource;
|
|
|
|
|
|
- private AuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
|
|
|
|
|
|
+ private SavedRequestAwareAuthenticationSuccessHandler defaultSuccessHandler = new SavedRequestAwareAuthenticationSuccessHandler();
|
|
|
|
+ private AuthenticationSuccessHandler successHandler = this.defaultSuccessHandler;
|
|
|
|
|
|
private LoginUrlAuthenticationEntryPoint authenticationEntryPoint;
|
|
private LoginUrlAuthenticationEntryPoint authenticationEntryPoint;
|
|
|
|
|
|
@@ -128,6 +130,7 @@ public abstract class AbstractAuthenticationFilterConfigurer<B extends HttpSecur
|
|
SavedRequestAwareAuthenticationSuccessHandler handler = new SavedRequestAwareAuthenticationSuccessHandler();
|
|
SavedRequestAwareAuthenticationSuccessHandler handler = new SavedRequestAwareAuthenticationSuccessHandler();
|
|
handler.setDefaultTargetUrl(defaultSuccessUrl);
|
|
handler.setDefaultTargetUrl(defaultSuccessUrl);
|
|
handler.setAlwaysUseDefaultTargetUrl(alwaysUse);
|
|
handler.setAlwaysUseDefaultTargetUrl(alwaysUse);
|
|
|
|
+ this.defaultSuccessHandler = handler;
|
|
return successHandler(handler);
|
|
return successHandler(handler);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -279,6 +282,11 @@ public abstract class AbstractAuthenticationFilterConfigurer<B extends HttpSecur
|
|
authenticationEntryPoint.setPortMapper(portMapper);
|
|
authenticationEntryPoint.setPortMapper(portMapper);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ RequestCache requestCache = http.getSharedObject(RequestCache.class);
|
|
|
|
+ if (requestCache != null) {
|
|
|
|
+ this.defaultSuccessHandler.setRequestCache(requestCache);
|
|
|
|
+ }
|
|
|
|
+
|
|
authFilter.setAuthenticationManager(http
|
|
authFilter.setAuthenticationManager(http
|
|
.getSharedObject(AuthenticationManager.class));
|
|
.getSharedObject(AuthenticationManager.class));
|
|
authFilter.setAuthenticationSuccessHandler(successHandler);
|
|
authFilter.setAuthenticationSuccessHandler(successHandler);
|