KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > dinamica > security > DinamicaUser


1 package dinamica.security;
2
3 import java.security.*;
4
5 /**
6 * Authenticated web user. This class is used by the RequestWrapper
7 * to provide the security principal. This way the SecurityFilter will
8 * provide support for the same J2EE security APIs.
9 */

10
11 public class DinamicaUser implements Principal, java.io.Serializable JavaDoc
12 {
13
14     /**
15      *
16      */

17     private static final long serialVersionUID = 1L;
18     String JavaDoc name = null;
19     String JavaDoc roles[] = null;
20
21     public DinamicaUser(String JavaDoc name, String JavaDoc roles[])
22     {
23         this.name = name;
24         this.roles = roles;
25     }
26
27     public String JavaDoc getName()
28     {
29         return name;
30     }
31
32     public String JavaDoc[] getRoles()
33     {
34         return this.roles;
35     }
36
37     public boolean equals(Object JavaDoc b)
38     {
39         if (!(b instanceof DinamicaUser))
40             return false;
41
42         return name.equals(((DinamicaUser) b).getName());
43     }
44
45     public int hashCode()
46     {
47         return name.hashCode();
48     }
49
50     public String JavaDoc toString()
51     {
52         return name;
53     }
54
55 }
56
Popular Tags