You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2018/07/04 10:48:22 UTC
[cxf-fediz] branch master updated: FEDIZ-220 - http 400 when logout
with redirect to constraint
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git
The following commit(s) were added to refs/heads/master by this push:
new a7b8fc5 FEDIZ-220 - http 400 when logout with redirect to constraint
a7b8fc5 is described below
commit a7b8fc5280ea4d890c6917bfdb01a49b0c03b98f
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Wed Jul 4 11:48:02 2018 +0100
FEDIZ-220 - http 400 when logout with redirect to constraint
---
.../src/main/java/org/apache/cxf/fediz/core/handler/LogoutHandler.java | 3 +--
.../org/apache/cxf/fediz/core/federation/FederationLogoutTest.java | 2 ++
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/plugins/core/src/main/java/org/apache/cxf/fediz/core/handler/LogoutHandler.java b/plugins/core/src/main/java/org/apache/cxf/fediz/core/handler/LogoutHandler.java
index 0a17bd7..c9fe079 100644
--- a/plugins/core/src/main/java/org/apache/cxf/fediz/core/handler/LogoutHandler.java
+++ b/plugins/core/src/main/java/org/apache/cxf/fediz/core/handler/LogoutHandler.java
@@ -20,7 +20,6 @@ package org.apache.cxf.fediz.core.handler;
import java.io.IOException;
import java.io.InputStream;
-import java.net.URLEncoder;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
@@ -111,7 +110,7 @@ public class LogoutHandler implements RequestHandler<Boolean> {
if (matcher.matches()) {
try {
LOG.debug("Redirecting user after logout to: {}", wreply);
- response.sendRedirect(URLEncoder.encode(wreply, "UTF-8"));
+ response.sendRedirect(response.encodeRedirectURL(wreply));
return true;
} catch (IOException e) {
LOG.error("Error redirecting user after logout: {}", e.getMessage());
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationLogoutTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationLogoutTest.java
index 3599a29..e40f861 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationLogoutTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationLogoutTest.java
@@ -383,6 +383,8 @@ public class FederationLogoutTest {
Assert.assertTrue(logoutHandler.canHandleRequest(req));
HttpServletResponse resp = EasyMock.createMock(HttpServletResponse.class);
+ String encodedResponse = "https%3A%2F%2Flocalhost%2Ffedizhelloworld%2Fsecure%2Fwreply.html";
+ EasyMock.expect(resp.encodeRedirectURL(REPLY_URL)).andReturn(encodedResponse);
String expectedRedirect = URLEncoder.encode(REPLY_URL, "UTF-8");
resp.sendRedirect(expectedRedirect);
EasyMock.expectLastCall();