Allow login.jsp tobe used by either container or IdP managed authentication
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 10 Jan 2008 17:04:35 +0000 (17:04 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 10 Jan 2008 17:04:35 +0000 (17:04 +0000)
Pass in action URL derived from authentication servlet when using IdP managed authn

git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@2553 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

resources/webpages/login.jsp
src/edu/internet2/middleware/shibboleth/idp/authn/provider/UsernamePasswordLoginServlet.java

index e1095b6..34670c9 100644 (file)
@@ -8,7 +8,11 @@
        <p>Authentication Failed</p>
        <% } %>
        
-       <form action="Authn/UserPassword" method="post">
+       <% if(request.getParameter("actionUrl") != null){ %>
+           <form action="<%=request.getParameter("actionUrl)%>" method="post">
+       <% }else{ %>
+           <form action="j_security_check" method="post">
+       <% } %>
        <table>
                <tr>
                        <td>Username:</td>
index 37fa83c..5a2ae8d 100644 (file)
@@ -127,10 +127,13 @@ public class UsernamePasswordLoginServlet extends HttpServlet {
             urlBuilder.setHost(request.getLocalName());
             urlBuilder.setPort(request.getLocalPort());
             urlBuilder.setPath(pathBuilder.toString());
-            if (queryParams != null) {
-                urlBuilder.getQueryParams().addAll(queryParams);
+            
+            if (queryParams == null) {
+                queryParams = new ArrayList<Pair<String, String>>();
+                queryParams.add(new Pair<String, String>("actionUrl", request.getPathInfo()));
             }
-
+            urlBuilder.getQueryParams().addAll(queryParams);
+            
             log.debug("Redirecting to login page {}", urlBuilder.buildURL());
             response.sendRedirect(urlBuilder.buildURL());
             return;