Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/server/auth/DefaultUser.java @ 5861:172338b1407f
GWT client: Added copyright header.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sun, 28 Apr 2013 14:30:15 +0200 |
parents | 5aa05a7a34b7 |
children | ea9eef426962 |
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 * |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
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 |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
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 |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 public class DefaultUser |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 implements User |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 protected String name; |
3504
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
17 protected String account; |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 protected String password; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 protected boolean expired; |
2978
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
20 protected List<String> 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
|
21 protected List<String> features; |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 public DefaultUser() { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 } |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 |
2980
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
26 public DefaultUser( |
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
27 String name, |
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
28 String password, |
3350
e746e57c65c0
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2981
diff
changeset
|
29 boolean expired, |
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 List<String> roles, |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
31 List<String> features |
2980
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
32 ) { |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 this.name = name; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 this.password = password; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 this.expired = expired; |
2980
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
36 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
|
37 this.features = features; |
3504
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
38 this.account = name; |
2959
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 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 @Override |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 public String getName() { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 return name; |
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 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 public void setName(String name) { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 this.name = name; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 } |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 @Override |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 public String getPassword() { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 return password; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 } |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 public void setPassword(String password) { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 this.password = password; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 } |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 @Override |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 public boolean hasExpired() { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 return expired; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 } |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 public void setExpired(boolean expired) { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 this.expired = expired; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 } |
2978
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
67 |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
68 @Override |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
69 public List<String> getRoles() { |
2980
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
70 // 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
|
71 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
|
72 } |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
73 |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
74 public void setRoles(List<String> roles) { |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
75 this.roles = roles; |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
76 } |
3485
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
77 |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
78 @Override |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
79 public boolean canUseFeature(String feature) { |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
80 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
|
81 } |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
82 |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
83 public void setAllowedFeatures(List<String> features) { |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
84 this.features = features; |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
85 } |
3504
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
86 |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
87 @Override |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
88 public String getAccount() { |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
89 return this.account; |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
90 } |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
91 |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
92 public void setAccount(String account) { |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
93 this.account = account; |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
94 } |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 } |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 // vim:set ts=4 sw=4 si et fenc=utf8 tw=80: |