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 2016/12/21 15:47:12 UTC
[2/3] cxf-fediz git commit: Fixing backmerge
Fixing backmerge
Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/5faa9003
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/5faa9003
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/5faa9003
Branch: refs/heads/1.2.x-fixes
Commit: 5faa90036c49c610cadf906dd9569303010eae51
Parents: 1635136
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Wed Dec 21 15:11:13 2016 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Wed Dec 21 15:29:59 2016 +0000
----------------------------------------------------------------------
.../core/processor/FederationProcessorImpl.java | 25 +++++++++-----------
.../core/federation/FederationLogoutTest.java | 11 +++++----
2 files changed, 17 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/5faa9003/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/FederationProcessorImpl.java
----------------------------------------------------------------------
diff --git a/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/FederationProcessorImpl.java b/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/FederationProcessorImpl.java
index ddc8e46..fbf7600 100644
--- a/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/FederationProcessorImpl.java
+++ b/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/FederationProcessorImpl.java
@@ -521,24 +521,21 @@ public class FederationProcessorImpl extends AbstractFedizProcessor {
}
}
+ if (logoutRedirectTo == null || logoutRedirectTo.isEmpty()) {
+ logoutRedirectTo = config.getLogoutRedirectTo();
+ }
+
if (logoutRedirectTo != null && !logoutRedirectTo.isEmpty()) {
+
+ if (logoutRedirectTo.startsWith("/")) {
+ logoutRedirectTo = extractFullContextPath(request).concat(logoutRedirectTo.substring(1));
+ } else {
+ logoutRedirectTo = extractFullContextPath(request).concat(logoutRedirectTo);
+ }
+
LOG.debug("wreply={}", logoutRedirectTo);
sb.append('&').append(FederationConstants.PARAM_REPLY).append('=');
sb.append(URLEncoder.encode(logoutRedirectTo, "UTF-8"));
- } else {
- logoutRedirectTo = config.getLogoutRedirectTo();
- if (logoutRedirectTo != null && !logoutRedirectTo.isEmpty()) {
-
- if (logoutRedirectTo.startsWith("/")) {
- logoutRedirectTo = extractFullContextPath(request).concat(logoutRedirectTo.substring(1));
- } else {
- logoutRedirectTo = extractFullContextPath(request).concat(logoutRedirectTo);
- }
-
- LOG.debug("wreply={}", logoutRedirectTo);
- sb.append('&').append(FederationConstants.PARAM_REPLY).append('=');
- sb.append(URLEncoder.encode(logoutRedirectTo, "UTF-8"));
- }
}
redirectURL = redirectURL + "?" + sb.toString();
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/5faa9003/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationLogoutTest.java
----------------------------------------------------------------------
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 dedc9f4..ee6775e 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
@@ -45,6 +45,7 @@ import org.junit.BeforeClass;
public class FederationLogoutTest {
private static final String LOGOUT_URL = "https://localhost/fedizhelloworld/secure/logout";
private static final String LOGOUT_URI = "/secure/logout";
+ private static final String REPLY_URI = "/wreply.html";
private static final String REPLY_URL = "https://localhost/fedizhelloworld/secure/wreply.html";
private static final String BAD_REPLY_URL = "https://localhost/fedizhelloworld/secure/badreply.html";
@@ -118,7 +119,7 @@ public class FederationLogoutTest {
HttpServletRequest req = EasyMock.createMock(HttpServletRequest.class);
EasyMock.expect(req.getParameter(FederationConstants.PARAM_ACTION)).andReturn(null).anyTimes();
- EasyMock.expect(req.getParameter(FederationConstants.PARAM_REPLY)).andReturn(REPLY_URL).anyTimes();
+ EasyMock.expect(req.getParameter(FederationConstants.PARAM_REPLY)).andReturn(REPLY_URI).anyTimes();
EasyMock.expect(req.getRequestURL()).andReturn(new StringBuffer(LOGOUT_URL));
EasyMock.expect(req.getRequestURI()).andReturn(LOGOUT_URI);
EasyMock.expect(req.getContextPath()).andReturn(LOGOUT_URI);
@@ -129,7 +130,7 @@ public class FederationLogoutTest {
HttpServletResponse resp = EasyMock.createMock(HttpServletResponse.class);
String expectedRedirectToIdP =
- "http://url_to_the_issuer?wa=wsignout1.0&wreply=" + URLEncoder.encode(REPLY_URL, "UTF-8");
+ "http://url_to_the_issuer?wa=wsignout1.0&wreply=https%3A%2F%2Flocalhost%2Fsecure%2Flogout%2Fwreply.html";
resp.sendRedirect(expectedRedirectToIdP);
EasyMock.expectLastCall();
EasyMock.replay(resp);
@@ -166,7 +167,7 @@ public class FederationLogoutTest {
HttpServletRequest req = EasyMock.createMock(HttpServletRequest.class);
EasyMock.expect(req.getParameter(FederationConstants.PARAM_ACTION)).andReturn(null).anyTimes();
- EasyMock.expect(req.getParameter(FederationConstants.PARAM_REPLY)).andReturn(REPLY_URL).anyTimes();
+ EasyMock.expect(req.getParameter(FederationConstants.PARAM_REPLY)).andReturn(REPLY_URI).anyTimes();
EasyMock.expect(req.getRequestURL()).andReturn(new StringBuffer(LOGOUT_URL));
EasyMock.expect(req.getRequestURI()).andReturn(LOGOUT_URI);
EasyMock.expect(req.getContextPath()).andReturn(LOGOUT_URI);
@@ -216,7 +217,7 @@ public class FederationLogoutTest {
HttpServletRequest req = EasyMock.createMock(HttpServletRequest.class);
EasyMock.expect(req.getParameter(FederationConstants.PARAM_ACTION))
.andReturn(FederationConstants.ACTION_SIGNOUT).anyTimes();
- EasyMock.expect(req.getParameter(FederationConstants.PARAM_REPLY)).andReturn(REPLY_URL).anyTimes();
+ EasyMock.expect(req.getParameter(FederationConstants.PARAM_REPLY)).andReturn(REPLY_URI).anyTimes();
EasyMock.expect(req.getRequestURL()).andReturn(new StringBuffer("https://localhost/fedizhelloworld/secure"));
EasyMock.expect(req.getRequestURI()).andReturn("/secure");
EasyMock.expect(req.getContextPath()).andReturn("/secure");
@@ -227,7 +228,7 @@ public class FederationLogoutTest {
HttpServletResponse resp = EasyMock.createMock(HttpServletResponse.class);
String expectedRedirectToIdP =
- "http://url_to_the_issuer?wa=wsignout1.0&wreply=" + URLEncoder.encode(REPLY_URL, "UTF-8");
+ "http://url_to_the_issuer?wa=wsignout1.0&wreply=https%3A%2F%2Flocalhost%2Fsecure%2Fwreply.html";
resp.sendRedirect(expectedRedirectToIdP);
EasyMock.expectLastCall();
EasyMock.replay(resp);