diff --git a/web/src/main/java/org/springframework/security/web/authentication/AbstractAuthenticationTargetUrlRequestHandler.java b/web/src/main/java/org/springframework/security/web/authentication/AbstractAuthenticationTargetUrlRequestHandler.java
index 22ed7ced2d..e8582cd17b 100644
--- a/web/src/main/java/org/springframework/security/web/authentication/AbstractAuthenticationTargetUrlRequestHandler.java
+++ b/web/src/main/java/org/springframework/security/web/authentication/AbstractAuthenticationTargetUrlRequestHandler.java
@@ -30,8 +30,8 @@ import org.springframework.util.StringUtils;
* will be used for the destination.
*
*
- * If a parameter matching the targetUrlParameter has been set on the request, the value will be used as
- * the destination.
+ * If a parameter matching the value of targetUrlParameter has been set on the request, the value will be used
+ * as the destination. By default this has the value "spring-security-redirect".
*
*
* If the useReferer property is set, the "Referer" HTTP header value will be used, if present.
@@ -154,7 +154,9 @@ public abstract class AbstractAuthenticationTargetUrlRequestHandler {
* to "spring-security-redirect".
*/
public void setTargetUrlParameter(String targetUrlParameter) {
- Assert.hasText(targetUrlParameter, "targetUrlParameter cannot be null or empty");
+ if (!StringUtils.hasText(targetUrlParameter)) {
+ targetUrlParameter = null;
+ }
this.targetUrlParameter = targetUrlParameter;
}
diff --git a/web/src/main/java/org/springframework/security/web/authentication/logout/SimpleUrlLogoutSuccessHandler.java b/web/src/main/java/org/springframework/security/web/authentication/logout/SimpleUrlLogoutSuccessHandler.java
index 440410f5b2..1e8675ccab 100644
--- a/web/src/main/java/org/springframework/security/web/authentication/logout/SimpleUrlLogoutSuccessHandler.java
+++ b/web/src/main/java/org/springframework/security/web/authentication/logout/SimpleUrlLogoutSuccessHandler.java
@@ -19,6 +19,10 @@ import org.springframework.security.web.authentication.AbstractAuthenticationTar
public class SimpleUrlLogoutSuccessHandler extends AbstractAuthenticationTargetUrlRequestHandler
implements LogoutSuccessHandler {
+ public SimpleUrlLogoutSuccessHandler() {
+ super.setTargetUrlParameter(null);
+ }
+
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
throws IOException, ServletException {
super.handle(request, response, authentication);