Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/server/auth/plain/Authenticator.java @ 8856:5e38e2924c07 3.2.x
Fix code style.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 18 Jan 2018 20:12:01 +0100 |
parents | 7bc35bbd8b27 |
children | d6d5ca6d4af0 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8855:d7c005e12af0 | 8856:5e38e2924c07 |
---|---|
34 { | 34 { |
35 private static final Logger log = | 35 private static final Logger log = |
36 Logger.getLogger(Authenticator.class); | 36 Logger.getLogger(Authenticator.class); |
37 | 37 |
38 public static class Authentication | 38 public static class Authentication |
39 implements org.dive4elements.river.client.server.auth.Authentication | 39 implements org.dive4elements.river.client.server.auth.Authentication |
40 { | 40 { |
41 protected String user; | 41 protected String user; |
42 protected String password; | 42 protected String password; |
43 protected List<String> roles; | 43 protected List<String> roles; |
44 protected Features features; | 44 protected Features features; |
61 } | 61 } |
62 | 62 |
63 @Override | 63 @Override |
64 public User getUser() { | 64 public User getUser() { |
65 return isSuccess() | 65 return isSuccess() |
66 ? new DefaultUser(user, password, null, false, roles, this.features.getFeatures(roles)) | 66 ? new DefaultUser( |
67 user, password, null, false, roles, | |
68 this.features.getFeatures(roles)) | |
67 : null; | 69 : null; |
68 } | 70 } |
69 } // class Authentication | 71 } // class Authentication |
70 | 72 |
71 public Authenticator() { | 73 public Authenticator() { |
96 throws AuthenticationException, IOException | 98 throws AuthenticationException, IOException |
97 { | 99 { |
98 File file = credentialsFile(); | 100 File file = credentialsFile(); |
99 if (!file.canRead() || !file.isFile()) { | 101 if (!file.canRead() || !file.isFile()) { |
100 log.error("cannot find user file '" + file + "'"); | 102 log.error("cannot find user file '" + file + "'"); |
101 return new Authentication(null, null, new ArrayList<String>(0), features); | 103 return new Authentication( |
104 null, null, new ArrayList<String>(0), features); | |
102 } | 105 } |
103 | 106 |
104 BufferedReader reader = | 107 BufferedReader reader = |
105 new BufferedReader( | 108 new BufferedReader( |
106 new FileReader(file)); | 109 new FileReader(file)); |
126 for (int i = 2; i < parts.length; i++) { | 129 for (int i = 2; i < parts.length; i++) { |
127 roles.add(parts[i]); | 130 roles.add(parts[i]); |
128 } | 131 } |
129 | 132 |
130 log.debug("success"); | 133 log.debug("success"); |
131 return new Authentication(username, password, roles, features); | 134 return new Authentication( |
135 username, password, roles, features); | |
132 } | 136 } |
133 // Stop: user found, wrong password | 137 // Stop: user found, wrong password |
134 break; | 138 break; |
135 } | 139 } |
136 } | 140 } |