changeset 2980:cc126abafeab

Cosmetics in plain authentication flys-client/trunk@4978 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 13 Jul 2012 09:42:38 +0000
parents 193a113888d4
children d700f6492386
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/server/auth/DefaultUser.java flys-client/src/main/java/de/intevation/flys/client/server/auth/plain/Authenticator.java
diffstat 3 files changed, 29 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Jul 13 09:41:17 2012 +0000
+++ b/flys-client/ChangeLog	Fri Jul 13 09:42:38 2012 +0000
@@ -1,3 +1,9 @@
+2012-07-12	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/auth/plain/Authenticator.java,
+	  src/main/java/de/intevation/flys/client/server/auth/DefaultUser.java:
+	  Cosmetics.
+
 2012-07-13	Björn Ricks	<bjoern.ricks@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/auth/User.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/server/auth/DefaultUser.java	Fri Jul 13 09:41:17 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/DefaultUser.java	Fri Jul 13 09:42:38 2012 +0000
@@ -14,11 +14,16 @@
     public DefaultUser() {
     }
 
-    public DefaultUser(String name, String password, boolean expired, List<String> roles) {
+    public DefaultUser(
+        String       name,
+        String       password,
+        boolean      expired, 
+        List<String> roles
+    ) {
         this.name     = name;
         this.password = password;
         this.expired  = expired;
-        this.roles = roles;
+        this.roles    = roles;
     }
 
     @Override
@@ -50,7 +55,7 @@
 
     @Override
     public List<String> getRoles() {
-        // return clone of the list?
+        // XXX: return clone of the list?
         return this.roles;
     }
 
--- a/flys-client/src/main/java/de/intevation/flys/client/server/auth/plain/Authenticator.java	Fri Jul 13 09:41:17 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/plain/Authenticator.java	Fri Jul 13 09:42:38 2012 +0000
@@ -8,8 +8,9 @@
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
+
+import java.util.ArrayList;
 import java.util.List;
-import java.util.ArrayList;
 
 public class Authenticator
 implements   de.intevation.flys.client.server.auth.Authenticator
@@ -17,11 +18,15 @@
     public static class Authentication
     implements          de.intevation.flys.client.server.auth.Authentication
     {
-        protected String user;
-        protected String password;
+        protected String       user;
+        protected String       password;
         protected List<String> roles;
 
-        public Authentication(String user, String password, List<String> roles) {
+        public Authentication(
+            String       user,
+            String       password,
+            List<String> roles
+        ) {
             this.user     = user;
             this.password = password;
             this.roles    = roles;
@@ -66,7 +71,7 @@
     {
         File file = credentialsFile();
         if (!file.canRead() || !file.isFile()) {
-            return new Authentication(null, null, new ArrayList<String>());
+            return new Authentication(null, null, new ArrayList<String>(0));
         }
 
         BufferedReader reader =
@@ -85,10 +90,13 @@
                 }
                 if (parts[0].equals(username)) {
                     if (parts[1].equals(password)) {
-                        List<String> roles = new ArrayList<String>(parts.length - 2);
+                        List<String> roles =
+                            new ArrayList<String>(parts.length - 2);
+
                         for (int i = 2; i < parts.length; i++) {
                             roles.add(parts[i]);
                         }
+
                         return new Authentication(username, password, roles);
                     }
                     // Stop: user found, wrong password
@@ -99,7 +107,7 @@
         finally {
             reader.close();
         }
-        return new Authentication(null, null, new ArrayList<String>());
+        return new Authentication(null, null, new ArrayList<String>(0));
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org