r1032 - xwiki/trunk/src/main/java/com/xpn/xwiki/user/impl/xwiki

Ludovic Dubost ludovic at users.forge.objectweb.org
Fri Apr 7 11:37:57 CEST 2006


Author: ludovic
Date: 2006-04-07 11:37:56 +0200 (Fri, 07 Apr 2006)
New Revision: 1032

Modified:
   xwiki/trunk/src/main/java/com/xpn/xwiki/user/impl/xwiki/MyFormAuthenticator.java
Log:
Add parameter to customer authentication error http return code because web unit tests don't like 401 code

Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/user/impl/xwiki/MyFormAuthenticator.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/user/impl/xwiki/MyFormAuthenticator.java	2006-04-07 05:51:57 UTC (rev 1031)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/user/impl/xwiki/MyFormAuthenticator.java	2006-04-07 09:37:56 UTC (rev 1032)
@@ -1,24 +1,24 @@
-/*
- * Copyright 2006, XpertNet SARL, and individual contributors as indicated
- * by the contributors.txt.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *
- * @author sdumitriu
- */
+/*
+ * Copyright 2006, XpertNet SARL, and individual contributors as indicated
+ * by the contributors.txt.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * @author sdumitriu
+ */
 
 
 package com.xpn.xwiki.user.impl.xwiki;
@@ -145,7 +145,16 @@
                 // set response status and forward to error page
                 if (log.isInfoEnabled()) log.info("User " + username + " login has failed");
 
-                response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+                String returnCode = context.getWiki().Param("xwiki.authentication.unauthorized_code");
+                int rCode = HttpServletResponse.SC_UNAUTHORIZED;
+                if ((returnCode!=null)&&(!returnCode.equals(""))) {
+                    try {
+                        rCode = Integer.parseInt(returnCode);
+                    } catch (Exception e) {
+                        rCode = HttpServletResponse.SC_UNAUTHORIZED;
+                    }
+                }
+                response.setStatus(rCode);
                 request.getRequestDispatcher(errorPage).forward(request, response);
             }
             return true;





More information about the Xwiki-notifications mailing list