# HG changeset patch # User Sascha L. Teichmann # Date 1342172558 0 # Node ID cc126abafeabb16a93a612edc14ef844cd618297 # Parent 193a113888d48cce8cf3a335bc9ef07b166fabd8 Cosmetics in plain authentication flys-client/trunk@4978 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 193a113888d4 -r cc126abafeab flys-client/ChangeLog --- 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 + + * 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 * src/main/java/de/intevation/flys/client/server/auth/User.java: diff -r 193a113888d4 -r cc126abafeab flys-client/src/main/java/de/intevation/flys/client/server/auth/DefaultUser.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 roles) { + public DefaultUser( + String name, + String password, + boolean expired, + List roles + ) { this.name = name; this.password = password; this.expired = expired; - this.roles = roles; + this.roles = roles; } @Override @@ -50,7 +55,7 @@ @Override public List getRoles() { - // return clone of the list? + // XXX: return clone of the list? return this.roles; } diff -r 193a113888d4 -r cc126abafeab flys-client/src/main/java/de/intevation/flys/client/server/auth/plain/Authenticator.java --- 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 roles; - public Authentication(String user, String password, List roles) { + public Authentication( + String user, + String password, + List 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()); + return new Authentication(null, null, new ArrayList(0)); } BufferedReader reader = @@ -85,10 +90,13 @@ } if (parts[0].equals(username)) { if (parts[1].equals(password)) { - List roles = new ArrayList(parts.length - 2); + List roles = + new ArrayList(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()); + return new Authentication(null, null, new ArrayList(0)); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :