1 package org.apache.turbine.om.security;
2
3 /* ====================================================================
4 * The Apache Software License, Version 1.1
5 *
6 * Copyright (c) 2001 The Apache Software Foundation. All rights
7 * reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
19 * distribution.
20 *
21 * 3. The end-user documentation included with the redistribution,
22 * if any, must include the following acknowledgment:
23 * "This product includes software developed by the
24 * Apache Software Foundation (http://www.apache.org/)."
25 * Alternately, this acknowledgment may appear in the software itself,
26 * if and wherever such third-party acknowledgments normally appear.
27 *
28 * 4. The names "Apache" and "Apache Software Foundation" and
29 * "Apache Turbine" must not be used to endorse or promote products
30 * derived from this software without prior written permission. For
31 * written permission, please contact apache@apache.org.
32 *
33 * 5. Products derived from this software may not be called "Apache",
34 * "Apache Turbine", nor may "Apache" appear in their name, without
35 * prior written permission of the Apache Software Foundation.
36 *
37 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
38 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
41 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
43 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
44 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
45 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
47 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48 * SUCH DAMAGE.
49 * ====================================================================
50 *
51 * This software consists of voluntary contributions made by many
52 * individuals on behalf of the Apache Software Foundation. For more
53 * information on the Apache Software Foundation, please see
54 * <http://www.apache.org/>.
55 */
56
57 import java.util.Date;
58 import java.util.Hashtable;
59 import java.io.Serializable;
60 import javax.servlet.http.HttpSessionBindingListener;
61 import org.apache.turbine.util.RunData;
62
63 /***
64 * This interface represents functionality that all users of the
65 * Turbine system require.
66 *
67 * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
68 * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
69 * @author <a href="mailto:jon@collab.net">Jon S. Stevens</a>
70 * @author <a href="mailto:cberry@gluecode.com">Craig D. Berry</a>
71 * @version $Id: User.java,v 1.1.1.1 2001/08/16 05:08:44 jvanzyl Exp $
72 */
73 public interface User
74 extends HttpSessionBindingListener, Serializable, SecurityEntity
75 {
76 /*** The 'perm storage' key name for the first name. */
77 public static final String FIRST_NAME = "FIRST_NAME";
78
79 /*** The 'perm storage' key name for the last name. */
80 public static final String LAST_NAME = "LAST_NAME";
81
82 /*** The 'perm storage' key name for the last_login field. */
83 public static final String LAST_LOGIN = "LAST_LOGIN";
84
85 /*** The 'perm storage' key name for the password field. */
86 public static final String PASSWORD = "PASSWORD_VALUE";
87
88 /*** The 'perm storage' key name for the username field. */
89 public static final String USERNAME = "LOGIN_NAME";
90
91 /*** The 'perm storage' key for the confirm_value field. */
92 public static final String CONFIRM_VALUE = "CONFIRM_VALUE";
93
94 /*** The 'perm storage' key for the email field. */
95 public static final String EMAIL = "EMAIL";
96
97 /*** This is the value that is stored in the database for confirmed users */
98 public static final String CONFIRM_DATA = "CONFIRMED";
99
100 /*** The 'perm storage' key name for the access counter. */
101 public static final String ACCESS_COUNTER = "_access_counter";
102
103 /*** The 'temp storage' key name for the session access counter */
104 public static final String SESSION_ACCESS_COUNTER = "_session_access_counter";
105
106 /*** The 'temp storage' key name for the 'has logged in' flag */
107 public static final String HAS_LOGGED_IN = "_has_logged_in";
108
109 /*** The session key for the User object. */
110 public static final String SESSION_KEY = "turbine.user";
111
112 /***
113 * Gets the access counter for a user from perm storage.
114 *
115 * @return The access counter for the user.
116 */
117 public int getAccessCounter();
118
119 /***
120 * Gets the access counter for a user during a session.
121 *
122 * @return The access counter for the user for the session.
123 */
124 public int getAccessCounterForSession();
125
126 /***
127 * Gets the last access date for this User. This is the last time
128 * that the user object was referenced.
129 *
130 * @return A Java Date with the last access date for the user.
131 */
132 public java.util.Date getLastAccessDate();
133
134 /***
135 * Gets the create date for this User. This is the time at which
136 * the user object was created.
137 *
138 * @return A Java Date with the date of creation for the user.
139 */
140 public java.util.Date getCreateDate();
141
142 /***
143 * Returns the user's last login date.
144 *
145 * @return A Java Date with the last login date for the user.
146 */
147 public java.util.Date getLastLogin();
148
149 /***
150 * Returns the user's password. This method should not be used by
151 * the application directly, because it's meaning depends upon
152 * the implementation of UserManager that manages this particular
153 * user object. Some implementations will use this attribute for
154 * storing a password encrypted in some way, other will not use
155 * it at all, when user entered password is presented to some external
156 * authority (like NT domain controller) to validate it.
157 * See also {@link org.apache.turbine.services.security.UserManager#authenticate(User,String)}.
158 *
159 * @return A String with the password for the user.
160 */
161 public String getPassword();
162
163 /***
164 * Get an object from permanent storage.
165 *
166 * @param name The object's name.
167 * @return An Object with the given name.
168 */
169 public Object getPerm ( String name );
170
171 /***
172 * Get an object from permanent storage; return default if value
173 * is null.
174 *
175 * @param name The object's name.
176 * @param def A default value to return.
177 * @return An Object with the given name.
178 */
179 public Object getPerm ( String name, Object def );
180
181 /***
182 * This should only be used in the case where we want to save the
183 * data to the database.
184 *
185 * @return A Hashtable.
186 */
187 public Hashtable getPermStorage();
188
189 /***
190 * This should only be used in the case where we want to save the
191 * data to the database.
192 *
193 * @return A Hashtable.
194 */
195 public Hashtable getTempStorage();
196
197 /***
198 * Get an object from temporary storage.
199 *
200 * @param name The object's name.
201 * @return An Object with the given name.
202 */
203 public Object getTemp ( String name );
204
205 /***
206 * Get an object from temporary storage; return default if value
207 * is null.
208 *
209 * @param name The object's name.
210 * @param def A default value to return.
211 * @return An Object with the given name.
212 */
213 public Object getTemp ( String name, Object def );
214
215 /***
216 * Returns the username for this user.
217 *
218 * @return A String with the username.
219 */
220 public String getUserName();
221
222 /***
223 * Returns the first name for this user.
224 *
225 * @return A String with the user's first name.
226 */
227
228 public String getFirstName();
229
230 /***
231 * Returns the last name for this user.
232 *
233 * @return A String with the user's last name.
234 */
235 public String getLastName();
236
237 /***
238 * Returns the email address for this user.
239 *
240 * @return A String with the user's email address.
241 */
242 public String getEmail();
243
244 /***
245 * This sets whether or not someone has logged in. hasLoggedIn()
246 * returns this value.
247 *
248 * @param value Whether someone has logged in or not.
249 */
250 public void setHasLoggedIn(Boolean value);
251
252 /***
253 * The user is considered logged in if they have not timed out.
254 *
255 * @return True if the user has logged in.
256 */
257 public boolean hasLoggedIn();
258
259 /***
260 * Increments the permanent hit counter for the user.
261 */
262 public void incrementAccessCounter();
263
264 /***
265 * Increments the session hit counter for the user.
266 */
267 public void incrementAccessCounterForSession();
268
269 /***
270 * Remove an object from temporary storage and return the object.
271 *
272 * @param name The name of the object to remove.
273 * @return An Object.
274 */
275 public Object removeTemp ( String name );
276
277 /***
278 * Sets the access counter for a user, saved in perm storage.
279 *
280 * @param cnt The new count.
281 */
282 public void setAccessCounter(int cnt);
283
284 /***
285 * Sets the session access counter for a user, saved in temp
286 * storage.
287 *
288 * @param cnt The new count.
289 */
290 public void setAccessCounterForSession(int cnt);
291
292 /***
293 * Sets the last access date for this User. This is the last time
294 * that the user object was referenced.
295 */
296 public void setLastAccessDate();
297
298 /***
299 * Set last login date/time.
300 *
301 * @param date The last login date.
302 */
303 public void setLastLogin(java.util.Date lastLogin);
304
305 /***
306 * Set password. Application should not use this method
307 * directly, see {@link #getPassword()}.
308 * See also {@link org.apache.turbine.services.security.UserManager#changePassword(User,String,String)}.
309 *
310 * @param password The new password.
311 */
312
313 public void setPassword(String password);
314
315 /***
316 * Put an object into permanent storage.
317 *
318 * @param name The object's name.
319 * @param value The object.
320 */
321 public void setPerm ( String name,
322 Object value );
323
324 /***
325 * This should only be used in the case where we want to save the
326 * data to the database.
327 *
328 * @param stuff A Hashtable.
329 */
330 public void setPermStorage(Hashtable stuff);
331
332 /***
333 * This should only be used in the case where we want to save the
334 * data to the database.
335 *
336 * @param storage A Hashtable.
337 */
338 public void setTempStorage(Hashtable stuff);
339
340 /***
341 * Put an object into temporary storage.
342 *
343 * @param name The object's name.
344 * @param value The object.
345 */
346 public void setTemp ( String name, Object value );
347
348 /***
349 * Sets the username for this user.
350 *
351 * @param username The user's username.
352 */
353 public void setUserName(String username);
354
355 /***
356 * Sets the first name for this user.
357 *
358 * @param firstName User's first name.
359 */
360 public void setFirstName(String firstName);
361
362 /***
363 * Sets the last name for this user.
364 *
365 * @param lastName User's last name.
366 */
367 public void setLastName(String lastName);
368
369 /***
370 * Sets the creation date for this user.
371 *
372 * @param date Creation date
373 */
374 public void setCreateDate(java.util.Date date);
375
376 /***
377 * Sets the email address.
378 *
379 * @param address The email address.
380 */
381 public void setEmail(String address);
382
383 /***
384 * This method reports whether or not the user has been confirmed
385 * in the system by checking the TurbineUserPeer.CONFIRM_VALUE
386 * column to see if it is equal to CONFIRM_DATA.
387 *
388 * @param user The User object.
389 * @return True if the user has been confirmed.
390 * @exception Exception, a generic exception.
391 */
392 public boolean isConfirmed();
393
394 /***
395 * Sets the confirmation value.
396 *
397 * @param value The confirmation key value.
398 */
399 public void setConfirmed(String value);
400
401 /***
402 * Gets the confirmation value.
403 *
404 * @return The confirmed value
405 */
406 public String getConfirmed();
407
408 /***
409 * Updates the last login date in the database.
410 *
411 * @exception Exception, a generic exception.
412 */
413 public void updateLastLogin()
414 throws Exception;
415 }
This page was automatically generated by Maven