KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > User


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18
19 package org.apache.catalina;
20
21
22 import java.security.Principal JavaDoc;
23 import java.util.Iterator JavaDoc;
24
25
26 /**
27  * <p>Abstract representation of a user in a {@link UserDatabase}. Each user
28  * is optionally associated with a set of {@link Group}s through which he or
29  * she inherits additional security roles, and is optionally assigned a set
30  * of specific {@link Role}s.</p>
31  *
32  * @author Craig R. McClanahan
33  * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
34  * @since 4.1
35  */

36
37 public interface User extends Principal JavaDoc {
38
39
40     // ------------------------------------------------------------- Properties
41

42
43     /**
44      * Return the full name of this user.
45      */

46     public String JavaDoc getFullName();
47
48
49     /**
50      * Set the full name of this user.
51      *
52      * @param fullName The new full name
53      */

54     public void setFullName(String JavaDoc fullName);
55
56
57     /**
58      * Return the set of {@link Group}s to which this user belongs.
59      */

60     public Iterator JavaDoc getGroups();
61
62
63     /**
64      * Return the logon password of this user, optionally prefixed with the
65      * identifier of an encoding scheme surrounded by curly braces, such as
66      * <code>{md5}xxxxx</code>.
67      */

68     public String JavaDoc getPassword();
69
70
71     /**
72      * Set the logon password of this user, optionally prefixed with the
73      * identifier of an encoding scheme surrounded by curly braces, such as
74      * <code>{md5}xxxxx</code>.
75      *
76      * @param password The new logon password
77      */

78     public void setPassword(String JavaDoc password);
79
80
81     /**
82      * Return the set of {@link Role}s assigned specifically to this user.
83      */

84     public Iterator JavaDoc getRoles();
85
86
87     /**
88      * Return the {@link UserDatabase} within which this User is defined.
89      */

90     public UserDatabase getUserDatabase();
91
92
93     /**
94      * Return the logon username of this user, which must be unique
95      * within the scope of a {@link UserDatabase}.
96      */

97     public String JavaDoc getUsername();
98
99
100     /**
101      * Set the logon username of this user, which must be unique within
102      * the scope of a {@link UserDatabase}.
103      *
104      * @param username The new logon username
105      */

106     public void setUsername(String JavaDoc username);
107
108
109     // --------------------------------------------------------- Public Methods
110

111
112     /**
113      * Add a new {@link Group} to those this user belongs to.
114      *
115      * @param group The new group
116      */

117     public void addGroup(Group group);
118
119
120     /**
121      * Add a {@link Role} to those assigned specifically to this user.
122      *
123      * @param role The new role
124      */

125     public void addRole(Role role);
126
127
128     /**
129      * Is this user in the specified {@link Group}?
130      *
131      * @param group The group to check
132      */

133     public boolean isInGroup(Group group);
134
135
136     /**
137      * Is this user specifically assigned the specified {@link Role}? This
138      * method does <strong>NOT</strong> check for roles inherited based on
139      * {@link Group} membership.
140      *
141      * @param role The role to check
142      */

143     public boolean isInRole(Role role);
144
145
146     /**
147      * Remove a {@link Group} from those this user belongs to.
148      *
149      * @param group The old group
150      */

151     public void removeGroup(Group group);
152
153
154     /**
155      * Remove all {@link Group}s from those this user belongs to.
156      */

157     public void removeGroups();
158
159
160     /**
161      * Remove a {@link Role} from those assigned to this user.
162      *
163      * @param role The old role
164      */

165     public void removeRole(Role role);
166
167
168     /**
169      * Remove all {@link Role}s from those assigned to this user.
170      */

171     public void removeRoles();
172
173
174 }
175
Popular Tags