Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/auth/DefaultUser.java @ 4231:adcb8aee1910
Add debug info about GGInA session lease time
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Tue, 23 Oct 2012 16:07:39 +0200 |
parents | 1387cdeb8d93 |
children |
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; |
3504
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
9 protected String account; |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 protected String password; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 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
|
12 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
|
13 protected List<String> features; |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 public DefaultUser() { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 } |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 |
2980
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
18 public DefaultUser( |
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
19 String name, |
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
20 String password, |
3350
e746e57c65c0
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2981
diff
changeset
|
21 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
|
22 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
|
23 List<String> features |
2980
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
24 ) { |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 this.name = name; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 this.password = password; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 this.expired = expired; |
2980
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
28 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
|
29 this.features = features; |
3504
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
30 this.account = name; |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 } |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 @Override |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 public String getName() { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 return name; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 } |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 public void setName(String name) { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 this.name = name; |
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 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 @Override |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 public String getPassword() { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 return password; |
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 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 public void setPassword(String password) { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 this.password = password; |
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 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 @Override |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 public boolean hasExpired() { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 return expired; |
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 |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 public void setExpired(boolean expired) { |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 this.expired = expired; |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 } |
2978
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
59 |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
60 @Override |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
61 public List<String> getRoles() { |
2980
cc126abafeab
Cosmetics in plain authentication
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2978
diff
changeset
|
62 // 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
|
63 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
|
64 } |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
65 |
98514ab2c9ba
Implement getting a list of roles from a logged in user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2959
diff
changeset
|
66 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
|
67 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
|
68 } |
3485
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
69 |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
70 @Override |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
71 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
|
72 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
|
73 } |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
74 |
71ba3cf3ec5e
Refactor Authentication to allow to pass the Freatures to the user class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3350
diff
changeset
|
75 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
|
76 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
|
77 } |
3504
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
78 |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
79 @Override |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
80 public String getAccount() { |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
81 return this.account; |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
82 } |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
83 |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
84 public void setAccount(String account) { |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
85 this.account = account; |
1387cdeb8d93
Add account information to flys-client user classes
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3490
diff
changeset
|
86 } |
2959
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 } |
5ba0a6efdf3b
Auth: added simple file based authentication.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 // vim:set ts=4 sw=4 si et fenc=utf8 tw=80: |