fix login form, and allow a couple of parameters to be overridden in web.xml
authorwnorris <wnorris@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Fri, 9 Nov 2007 21:32:39 +0000 (21:32 +0000)
committerwnorris <wnorris@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Fri, 9 Nov 2007 21:32:39 +0000 (21:32 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@2460 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

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

index 531d6a8..e1095b6 100644 (file)
@@ -3,6 +3,12 @@
        <body>
        <img src="<%= request.getContextPath() %>/images/logo.jpg" />
        <h2>Shibboleth Identity Provider Login</h2>
+       
+       <% if ("true".equals(request.getParameter("loginFailed"))) { %>
+       <p>Authentication Failed</p>
+       <% } %>
+       
+       <form action="Authn/UserPassword" method="post">
        <table>
                <tr>
                        <td>Username:</td>
@@ -13,8 +19,9 @@
                        <td><input name="j_password" type="password" tabindex="2" /></td>
                </tr>
                <tr>
-                       <td rowspan="2"><button tabindex="3"/></td>
+                       <td rowspan="2"><input type="submit" value="Login" tabindex="3" /></td>
                </tr>
        </table>
+       </form>
        
 </html>
\ No newline at end of file
index 73bfe28..37fa83c 100644 (file)
@@ -56,10 +56,16 @@ public class UsernamePasswordLoginServlet extends HttpServlet {
     private final Logger log = LoggerFactory.getLogger(RemoteUserAuthServlet.class);
 
     /** Name of JAAS configuration used to authenticate users. */
-    private final String jaasConfigName = "ShibUserPassAuth";
+    private String jaasConfigName = "ShibUserPassAuth";
+
+    /** init-param which can be passed to the servlet to override the default JAAS config. */
+    private final String jaasInitParam = "jaasConfigName";
 
     /** Login page name. */
-    private final String loginPage = "login.jsp";
+    private String loginPage = "login.jsp";
+    
+    /** init-param which can be passed to the servlet to override the default login page. */
+    private final String loginPageInitParam = "loginPage";
     
     /** Parameter name to indicate login failure. */
     private final String failureParam = "loginFailed";
@@ -71,6 +77,16 @@ public class UsernamePasswordLoginServlet extends HttpServlet {
     private final String passwordAttribute = "j_password";
 
     /** {@inheritDoc} */
+    public void init() {
+        if (getInitParameter(jaasInitParam) != null) {
+            jaasConfigName = getInitParameter(jaasInitParam);        
+        }
+        if (getInitParameter(loginPageInitParam) != null) {
+            loginPage = getInitParameter(loginPageInitParam);        
+        }        
+    }
+    
+    /** {@inheritDoc} */
     protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException,
             IOException {
         String username = DatatypeHelper.safeTrimOrNullString(request.getParameter(usernameAttribute));