01: package dinamica.security;
02:
03: import java.security.*;
04:
05: /**
06: * Authenticated web user. This class is used by the RequestWrapper
07: * to provide the security principal. This way the SecurityFilter will
08: * provide support for the same J2EE security APIs.
09: */
10:
11: public class DinamicaUser implements Principal, java.io.Serializable {
12:
13: /**
14: *
15: */
16: private static final long serialVersionUID = 1L;
17: String name = null;
18: String roles[] = null;
19:
20: public DinamicaUser(String name, String roles[]) {
21: this .name = name;
22: this .roles = roles;
23: }
24:
25: public String getName() {
26: return name;
27: }
28:
29: public String[] getRoles() {
30: return this .roles;
31: }
32:
33: public boolean equals(Object b) {
34: if (!(b instanceof DinamicaUser))
35: return false;
36:
37: return name.equals(((DinamicaUser) b).getName());
38: }
39:
40: public int hashCode() {
41: return name.hashCode();
42: }
43:
44: public String toString() {
45: return name;
46: }
47:
48: }
|