changeset 2985:1f64ee424f92

Corrected broken web.xml flys-client/trunk@4996 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 13 Jul 2012 13:51:58 +0000
parents 06d999e95615
children 176d915573e9
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/server/auth/AuthenticationException.java flys-client/src/main/java/de/intevation/flys/client/server/auth/AuthenticationFactory.java flys-client/src/main/java/de/intevation/flys/client/server/auth/plain/Authenticator.java flys-client/src/main/java/de/intevation/flys/client/server/auth/was/ServiceException.java flys-client/src/main/webapp/WEB-INF/web.xml
diffstat 6 files changed, 30 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Jul 13 13:38:32 2012 +0000
+++ b/flys-client/ChangeLog	Fri Jul 13 13:51:58 2012 +0000
@@ -1,3 +1,15 @@
+2012-07-13	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/webapp/WEB-INF/web.xml: Separate two context params correctly.
+
+	* src/main/java/de/intevation/flys/client/server/auth/was/ServiceException.java,
+	  src/main/java/de/intevation/flys/client/server/auth/AuthenticationException.java:
+	  Removed imports.
+
+	* src/main/java/de/intevation/flys/client/server/auth/plain/Authenticator.java,
+	  src/main/java/de/intevation/flys/client/server/auth/AuthenticationFactory.java:
+	  Added debug output.
+
 2012-07-13	Björn Ricks	<bjoern.ricks@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/LoginServlet.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/server/auth/AuthenticationException.java	Fri Jul 13 13:38:32 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/AuthenticationException.java	Fri Jul 13 13:51:58 2012 +0000
@@ -1,7 +1,5 @@
 package de.intevation.flys.client.server.auth;
 
-import java.lang.Exception;
-
 /**
  * Base class for Authentication related Exceptions
  */
--- a/flys-client/src/main/java/de/intevation/flys/client/server/auth/AuthenticationFactory.java	Fri Jul 13 13:38:32 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/AuthenticationFactory.java	Fri Jul 13 13:51:58 2012 +0000
@@ -1,18 +1,23 @@
 package de.intevation.flys.client.server.auth;
 
-import java.lang.IllegalArgumentException;
+import org.apache.log4j.Logger;
 
 public class AuthenticationFactory {
 
+    private static final Logger log =
+        Logger.getLogger(AuthenticationFactory.class);
+
     public static Authenticator getInstance(String name)
         throws IllegalArgumentException {
         if (name == null
         || name.equalsIgnoreCase("was")
         || name.equalsIgnoreCase("ggina")) {
+            log.debug("Using GGinA authenticator.");
             return
                 new de.intevation.flys.client.server.auth.was.Authenticator();
         }
         if (name.equalsIgnoreCase("plain")) {
+            log.debug("Using plain authenticator.");
             return
                 new de.intevation.flys.client.server.auth.plain.Authenticator();
         }
--- a/flys-client/src/main/java/de/intevation/flys/client/server/auth/plain/Authenticator.java	Fri Jul 13 13:38:32 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/plain/Authenticator.java	Fri Jul 13 13:51:58 2012 +0000
@@ -12,9 +12,14 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.log4j.Logger;
+
 public class Authenticator
 implements   de.intevation.flys.client.server.auth.Authenticator
 {
+    private static final Logger log =
+        Logger.getLogger(Authenticator.class);
+
     public static class Authentication
     implements          de.intevation.flys.client.server.auth.Authentication
     {
@@ -71,6 +76,7 @@
     {
         File file = credentialsFile();
         if (!file.canRead() || !file.isFile()) {
+            log.error("cannot find user file '" + file + "'");
             return new Authentication(null, null, new ArrayList<String>(0));
         }
 
@@ -89,6 +95,7 @@
                     continue;
                 }
                 if (parts[0].equals(username)) {
+                    log.debug("user '" + username + "' found.");
                     if (parts[1].equals(password)) {
                         List<String> roles =
                             new ArrayList<String>(parts.length - 2);
@@ -97,6 +104,7 @@
                             roles.add(parts[i]);
                         }
 
+                        log.debug("success");
                         return new Authentication(username, password, roles);
                     }
                     // Stop: user found, wrong password
@@ -107,6 +115,7 @@
         finally {
             reader.close();
         }
+        log.debug("failed");
         return new Authentication(null, null, new ArrayList<String>(0));
     }
 }
--- a/flys-client/src/main/java/de/intevation/flys/client/server/auth/was/ServiceException.java	Fri Jul 13 13:38:32 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/was/ServiceException.java	Fri Jul 13 13:51:58 2012 +0000
@@ -1,7 +1,5 @@
 package de.intevation.flys.client.server.auth.was;
 
-import java.lang.Exception;
-
 import de.intevation.flys.client.server.auth.AuthenticationException;
 
 public class ServiceException extends AuthenticationException {
--- a/flys-client/src/main/webapp/WEB-INF/web.xml	Fri Jul 13 13:38:32 2012 +0000
+++ b/flys-client/src/main/webapp/WEB-INF/web.xml	Fri Jul 13 13:51:58 2012 +0000
@@ -8,6 +8,9 @@
     <context-param>
         <param-name>server-url</param-name>
         <param-value>http://localhost:8181</param-value>
+    </context-param>
+
+    <context-param>
         <param-name>authentication</param-name>
         <param-value>GGInA</param-value>
     </context-param>

http://dive4elements.wald.intevation.org