|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| package org.acegisecurity.userdetails.memory; |
|
17 |
| |
|
18 |
| import java.util.List; |
|
19 |
| import java.util.Vector; |
|
20 |
| |
|
21 |
| import org.acegisecurity.GrantedAuthority; |
|
22 |
| import org.acegisecurity.GrantedAuthorityImpl; |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| public class UserAttribute { |
|
33 |
| |
|
34 |
| |
|
35 |
| private List authorities = new Vector(); |
|
36 |
| private String password; |
|
37 |
| private boolean enabled = true; |
|
38 |
| |
|
39 |
| |
|
40 |
| |
|
41 |
161
| public UserAttribute() {
|
|
42 |
161
| super();
|
|
43 |
| } |
|
44 |
| |
|
45 |
| |
|
46 |
| |
|
47 |
165
| public GrantedAuthority[] getAuthorities() {
|
|
48 |
165
| GrantedAuthority[] toReturn = {new GrantedAuthorityImpl("demo")};
|
|
49 |
| |
|
50 |
165
| return (GrantedAuthority[]) this.authorities.toArray(toReturn);
|
|
51 |
| } |
|
52 |
| |
|
53 |
50
| public void setEnabled(boolean enabled) {
|
|
54 |
50
| this.enabled = enabled;
|
|
55 |
| } |
|
56 |
| |
|
57 |
153
| public boolean isEnabled() {
|
|
58 |
153
| return enabled;
|
|
59 |
| } |
|
60 |
| |
|
61 |
161
| public void setPassword(String password) {
|
|
62 |
161
| this.password = password;
|
|
63 |
| } |
|
64 |
| |
|
65 |
157
| public String getPassword() {
|
|
66 |
157
| return password;
|
|
67 |
| } |
|
68 |
| |
|
69 |
160
| public boolean isValid() {
|
|
70 |
160
| if ((this.password != null) && (authorities.size() > 0)) {
|
|
71 |
157
| return true;
|
|
72 |
| } else { |
|
73 |
3
| return false;
|
|
74 |
| } |
|
75 |
| } |
|
76 |
| |
|
77 |
210
| public void addAuthority(GrantedAuthority newAuthority) {
|
|
78 |
210
| this.authorities.add(newAuthority);
|
|
79 |
| } |
|
80 |
| } |