Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/server/auth/DefaultUser.java @ 9497:d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
Some cleanup/refaktoring.
author | gernotbelger |
---|---|
date | Thu, 27 Sep 2018 17:40:39 +0200 |
parents | 7bc35bbd8b27 |
children |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.server.auth; |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
2978
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
11 import java.util.List; |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
12 |
9497
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
13 public class DefaultUser implements User { |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
14 private final String name; |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
15 private final String account; |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
16 private final String password; |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
17 private final String samlXML; |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
18 private final boolean expired; |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
19 private final List<String> roles; |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
20 private final List<String> features; |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
21 private final String userGroup; |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 |
9497
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
23 public DefaultUser(final String name, final String password, final String samlXML, final boolean expired, final List<String> roles, |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
24 final List<String> features, final String userGroup) { |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
25 this.name = name; |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 this.password = password; |
9497
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
27 this.samlXML = samlXML; |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
28 this.expired = expired; |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
29 this.roles = roles; |
3485
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
30 this.features = features; |
9497
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
31 this.account = name; |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
32 this.userGroup = userGroup; |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 } |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 @Override |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 public String getName() { |
9497
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
37 return this.name; |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 } |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 @Override |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 public String getPassword() { |
9497
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
42 return this.password; |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 } |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 @Override |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 public boolean hasExpired() { |
9497
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
47 return this.expired; |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 } |
2978
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
49 |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
50 @Override |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
51 public List<String> getRoles() { |
2980
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
52 // XXX: return clone of the list? |
2978
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
53 return this.roles; |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
54 } |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
55 |
9497
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
56 public List<String> getAllowedFeatures() { |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
57 return this.features; |
2978
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
58 } |
3485
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
59 |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
60 @Override |
9497
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
61 public boolean canUseFeature(final String feature) { |
3485
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
62 return this.features.contains(feature); |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
63 } |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
64 |
3504
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
65 @Override |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
66 public String getAccount() { |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
67 return this.account; |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
68 } |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
69 |
6187
7bc35bbd8b27
Store the SAML ticket in the user object after authentication.
Bernhard Herzog <bh@intevation.de>
parents:
5993
diff
changeset
|
70 @Override |
7bc35bbd8b27
Store the SAML ticket in the user object after authentication.
Bernhard Herzog <bh@intevation.de>
parents:
5993
diff
changeset
|
71 public String getSamlXMLBase64() { |
7bc35bbd8b27
Store the SAML ticket in the user object after authentication.
Bernhard Herzog <bh@intevation.de>
parents:
5993
diff
changeset
|
72 return this.samlXML; |
7bc35bbd8b27
Store the SAML ticket in the user object after authentication.
Bernhard Herzog <bh@intevation.de>
parents:
5993
diff
changeset
|
73 } |
7bc35bbd8b27
Store the SAML ticket in the user object after authentication.
Bernhard Herzog <bh@intevation.de>
parents:
5993
diff
changeset
|
74 |
9497
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
75 @Override |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
76 public String getUserGroup() { |
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
77 return this.userGroup; |
6187
7bc35bbd8b27
Store the SAML ticket in the user object after authentication.
Bernhard Herzog <bh@intevation.de>
parents:
5993
diff
changeset
|
78 } |
9497
d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
gernotbelger
parents:
6187
diff
changeset
|
79 } |