use helper method to create redirect URL - SIDP-447
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 21 Dec 2010 14:27:08 +0000 (14:27 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 21 Dec 2010 14:27:08 +0000 (14:27 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/branches/REL_2@2967 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

doc/RELEASE-NOTES.txt
src/main/java/edu/internet2/middleware/shibboleth/idp/authn/provider/RemoteUserLoginHandler.java

index 8522e4d..3aec949 100644 (file)
@@ -6,6 +6,7 @@ Changes in Release 2.2.1
 [SIDP-428] - Address lifecycle issues around use of MetadataCredentialResolverFactory
 [SIDP-431] - Typo in default attribute-resolver.xml
 [SIDP-434] - More Typos in Default attribute-resolver.xml
+[SIDP-447] - Fix for SIDP-417 missed RemoteUserLoginHandler
 
 Changes in Release 2.2.0
 =============================================
index c8f75a7..e509391 100644 (file)
@@ -21,10 +21,11 @@ import java.io.IOException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.opensaml.util.URLBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import edu.internet2.middleware.shibboleth.idp.util.HttpServletHelper;
+
 /**
  * Authentication Handler that redirects to servlet protected by a Web Single-Sign-On system.
  */
@@ -59,21 +60,10 @@ public class RemoteUserLoginHandler extends AbstractLoginHandler {
 
         // forward control to the servlet.
         try {
-            StringBuilder pathBuilder = new StringBuilder();
-            pathBuilder.append(httpRequest.getContextPath());
-            if (!servletURL.startsWith("/")) {
-                pathBuilder.append("/");
-            }
-            pathBuilder.append(servletURL);
-
-            URLBuilder urlBuilder = new URLBuilder();
-            urlBuilder.setScheme(httpRequest.getScheme());
-            urlBuilder.setHost(httpRequest.getServerName());
-            urlBuilder.setPort(httpRequest.getServerPort());
-            urlBuilder.setPath(pathBuilder.toString());
+            String profileUrl = HttpServletHelper.getContextRelativeUrl(httpRequest, servletURL).buildURL();
 
-            log.debug("Redirecting to {}", urlBuilder.buildURL());
-            httpResponse.sendRedirect(urlBuilder.buildURL());
+            log.debug("Redirecting to {}", profileUrl);
+            httpResponse.sendRedirect(profileUrl);
             return;
         } catch (IOException ex) {
             log.error("Unable to redirect to remote user authentication servlet.", ex);