Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/auth/DefaultUser.java @ 3490:5f628a13ca9f
Removed superfluous imports.
flys-client/trunk@5194 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 13 Aug 2012 07:58:47 +0000 |
parents | 71ba3cf3ec5e |
children | 1387cdeb8d93 |
rev | line source |
---|---|
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server.auth; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
2978
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
3 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
|
4 |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 public class DefaultUser |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 implements User |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 protected String name; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 protected String password; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 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
|
11 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
|
12 protected List<String> features; |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 public DefaultUser() { |
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 |
2980
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
17 public DefaultUser( |
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
18 String name, |
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
19 String password, |
3350
e746e57c65c0
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2981
diff
changeset
|
20 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
|
21 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
|
22 List<String> features |
2980
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
23 ) { |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 this.name = name; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 this.password = password; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 this.expired = expired; |
2980
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
27 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
|
28 this.features = features; |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 } |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 @Override |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 public String getName() { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 return name; |
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 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 public void setName(String name) { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 this.name = name; |
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() { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 return password; |
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 public void setPassword(String password) { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 this.password = password; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 } |
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 @Override |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 public boolean hasExpired() { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 return expired; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 } |
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 public void setExpired(boolean expired) { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 this.expired = expired; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 } |
2978
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
57 |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
58 @Override |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
59 public List<String> getRoles() { |
2980
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
60 // 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
|
61 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
|
62 } |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
63 |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
64 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
|
65 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
|
66 } |
3485
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
67 |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
68 @Override |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
69 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
|
70 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
|
71 } |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
72 |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
73 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
|
74 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
|
75 } |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 } |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 // vim:set ts=4 sw=4 si et fenc=utf8 tw=80: |