KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jcorporate > expresso > core > security > UserInfo


1 /* ====================================================================
2  * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
3  *
4  * Copyright (c) 1995-2002 Jcorporate Ltd. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  *
18  * 3. The end-user documentation included with the redistribution,
19  * if any, must include the following acknowledgment:
20  * "This product includes software developed by Jcorporate Ltd.
21  * (http://www.jcorporate.com/)."
22  * Alternately, this acknowledgment may appear in the software itself,
23  * if and wherever such third-party acknowledgments normally appear.
24  *
25  * 4. "Jcorporate" and product names such as "Expresso" must
26  * not be used to endorse or promote products derived from this
27  * software without prior written permission. For written permission,
28  * please contact info@jcorporate.com.
29  *
30  * 5. Products derived from this software may not be called "Expresso",
31  * or other Jcorporate product names; nor may "Expresso" or other
32  * Jcorporate product names appear in their name, without prior
33  * written permission of Jcorporate Ltd.
34  *
35  * 6. No product derived from this software may compete in the same
36  * market space, i.e. framework, without prior written permission
37  * of Jcorporate Ltd. For written permission, please contact
38  * partners@jcorporate.com.
39  *
40  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
41  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
42  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
43  * DISCLAIMED. IN NO EVENT SHALL JCORPORATE LTD OR ITS CONTRIBUTORS
44  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
45  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
46  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
47  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
48  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
49  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
50  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51  * SUCH DAMAGE.
52  * ====================================================================
53  *
54  * This software consists of voluntary contributions made by many
55  * individuals on behalf of the Jcorporate Ltd. Contributions back
56  * to the project(s) are encouraged when you make modifications.
57  * Please send them to support@jcorporate.com. For more information
58  * on Jcorporate Ltd. and its products, please see
59  * <http://www.jcorporate.com/>.
60  *
61  * Portions of this software are based upon other open source
62  * products and are subject to their respective licenses.
63  */

64
65 package com.jcorporate.expresso.core.security;
66
67 import com.jcorporate.expresso.core.db.DBException;
68 import com.jcorporate.expresso.core.dbobj.LookupInterface;
69
70 import java.util.Vector JavaDoc;
71
72
73 /**
74  * UserInfo defines the interface to an object that provides information about a user
75  * this object may get it's information from LDAP, Database, or any other source
76  *
77  * @author Michael Nash
78  */

79 public interface UserInfo extends LookupInterface {
80     /**
81      * Adds the current UserInfo object into the repository
82      *
83      * @throws DBException If the add fails
84      */

85     public void add() throws DBException;
86
87     /**
88      * Deletes the current UserInfo object from the repository
89      *
90      * @throws DBException If the delete fails
91      */

92     public void delete() throws DBException;
93
94     /**
95      * Find a UserInfo object in the repository that matches the non-empty properties filled in the current UserInfo object
96      *
97      * @return true if the user is found
98      * @throws DBException If the find fails
99      */

100     public boolean find() throws DBException;
101
102     /**
103      * Retrieve the current account status. Valid values are "A" (active), "I" (inactive), "D" (disabled)
104      *
105      * @return java.lang.String
106      * @throws DBException If the find fails
107      */

108     public String JavaDoc getAccountStatus() throws DBException;
109
110     /**
111      * Returns a Vector of all the UserInfo objects in the repository
112      *
113      * @return java.util.Vector
114      * @throws DBException If there is an error during the retrieval
115      */

116     public Vector JavaDoc getAllUsers() throws DBException;
117
118     /**
119      * Returns the date that this UserInfo object was created
120      *
121      * @return java.lang.String
122      * @throws DBException If there is an error during the retrieval
123      */

124     public String JavaDoc getCreateDate() throws DBException;
125
126     /**
127      * Returns the email address for this user
128      *
129      * @return java.lang.String
130      * @throws DBException If there is an error during the retrieval
131      */

132     public String JavaDoc getEmail() throws DBException;
133
134     /**
135      * Returns the email auth code previously set for this user
136      *
137      * @return java.lang.String
138      * @throws DBException If there is an error during the retrieval
139      */

140     public String JavaDoc getEmailAuthCode() throws DBException;
141
142     /**
143      * Retrieve the validation code required for authorization by email
144      *
145      * @return java.lang.String
146      * @throws DBException If the find fails
147      */

148     public String JavaDoc getEmailValCode() throws DBException;
149
150     /**
151      * Return a vector of the group names that this user belongs to
152      *
153      * @param fieldName The field to retrieve
154      * @return Vector Group names that this user belongs to
155      * @throws DBException If an error occurs when the group info is read
156      * @deprecated Use the direct getLoginName, getEmail, getPassword, etc. methods instead
157      */

158     public String JavaDoc getField(String JavaDoc fieldName) throws DBException;
159
160     /**
161      * Return a vector of the group names that this user belongs to
162      *
163      * @return Vector Group names that this user belongs to
164      * @throws DBException If an error occurs when the group info is read
165      */

166     public Vector JavaDoc getGroups() throws DBException;
167
168     /**
169      * Returns the login name of this user
170      *
171      * @return java.lang.String
172      * @throws DBException If there is an error during the retrieval
173      */

174     public String JavaDoc getLoginName() throws DBException;
175
176     /**
177      * Returns the password for this user
178      *
179      * @return java.lang.String
180      * @throws DBException If there is an error during the retrieval
181      */

182     public String JavaDoc getPassword() throws DBException;
183
184     /**
185      * Returns the status of whether extended registration has been completed or not
186      * Valid values are "Y" or "N"
187      *
188      * @return java.lang.String
189      * @throws DBException If there is an error during the retrieval
190      */

191     public boolean getRegComplete() throws DBException;
192
193     /**
194      * Returns the unique integer for the registration domain that this user belongs to
195      *
196      * @return java.lang.String
197      * @throws com.jcorporate.expresso.core.db.DBException
198      * If the underlying User implementation throws the same
199      */

200     public String JavaDoc getRegistrationDomain() throws DBException;
201
202     /**
203      * Returns the user id for this user
204      *
205      * @return java.lang.String
206      * @throws DBException If there is an error during the retrieval
207      */

208     public int getUid() throws DBException;
209
210     /**
211      * Returns the date that this UserInfo object was last modified
212      *
213      * @return java.lang.String
214      * @throws DBException If there is an error during the retrieval
215      */

216     public String JavaDoc getUpdateDate() throws DBException;
217
218     /**
219      * Returns the descriptive string for this user
220      *
221      * @return java.lang.String
222      * @throws DBException If there is an error during the retrieval
223      */

224     public String JavaDoc getUserName() throws DBException;
225
226     /**
227      * Checks if the given password equals what we have on file. We don't
228      * directly compare userInfo fields because often we store the password
229      * in a hash instead of a normal string so we have to take the testPassword,
230      * hash it and compare the two hashes.
231      *
232      * @param testPassword The string to test if it's a correct password
233      * @return true if the testPassword equals the password on file.
234      * @throws DBException If an error occurs when the group info is read
235      */

236     public boolean passwordEquals(String JavaDoc testPassword) throws DBException;
237
238     /**
239      * Retrieves the current user from the repository
240      *
241      * @throws DBException If the add fails
242      */

243     public void retrieve() throws DBException;
244
245     /**
246      * @throws DBException
247      */

248     public void sendAuthEmail() throws DBException;
249
250     /**
251      * @throws DBException
252      */

253     public void sendFollowUpEmail() throws DBException;
254
255     /**
256      * Sets the current status of the account - "A" (active), "D" (disabled), "I" (inactive)
257      *
258      * @param accountStatus java.lang.String
259      * @throws DBException If there is an error
260      */

261     public void setAccountStatus(String JavaDoc accountStatus) throws DBException;
262
263     /**
264      * Sets the DB context
265      *
266      * @param newDBName java.lang.String
267      * @throws DBException If there is an error
268      */

269     public void setDBName(String JavaDoc newDBName) throws DBException;
270
271     /**
272      * gets the DB context; can return null
273      *
274      * @deprecated since 5.6, use getDataContext() instead
275      */

276     public String JavaDoc getDBName();
277
278     /**
279      * gets the DB context; can return null
280      */

281     public String JavaDoc getDataContext();
282
283     /**
284      * Sets the email address
285      *
286      * @param email java.lang.String
287      * @throws DBException If there is an error
288      */

289     public void setEmail(String JavaDoc email) throws DBException;
290
291     /* setEmailValCode(String) */
292     /**
293      * Sets the code required for auth. via email
294      *
295      * @param code java.lang.String
296      * @throws DBException If there is an error
297      */

298     public void setEmailValCode(String JavaDoc code) throws DBException;
299
300
301     /**
302      * Sets the login name
303      *
304      * @param loginName java.lang.String
305      * @throws DBException If there is an error
306      */

307     public void setLoginName(String JavaDoc loginName) throws DBException;
308
309     /**
310      * Sets the password
311      *
312      * @param password java.lang.String
313      * @throws DBException If there is an error
314      */

315     public void setPassword(String JavaDoc password) throws DBException;
316
317     /**
318      * Sets the extended registration complete flag - "Y" or "N"
319      *
320      * @param status java.lang.String
321      * @throws DBException If there is an error
322      */

323     public void setRegComplete(boolean status) throws DBException;
324
325     /**
326      * Sets the registration domain
327      *
328      * @param id java.lang.String
329      * @throws DBException If there is an error
330      * @see com.jcorporate.expresso.services.dbobj.RegistrationDomain
331      */

332     public void setRegistrationDomain(String JavaDoc id) throws DBException;
333
334     /**
335      * Sets the user UID
336      *
337      * @param uid The uid of the user
338      * @throws DBException If there is an error
339      */

340     public void setUid(int uid) throws DBException;
341
342     /**
343      * Sets the user name
344      *
345      * @param name java.lang.String
346      * @throws DBException If there is an error
347      */

348     public void setUserName(String JavaDoc name) throws DBException;
349
350     /**
351      * Update the user in the repository with modified properties
352      *
353      * @throws DBException If the add fails
354      */

355     public void update() throws DBException;
356
357     /**
358      * the primary group of this user is appropriate for unix-like purposes,
359      * such as setting the group for a file permission
360      *
361      * @return name of the primary group of this user; null if no group is found
362      */

363     public String JavaDoc getPrimaryGroup() throws DBException;
364
365     /**
366      * this returns an appropriately hashed password.
367      *
368      * @return appropriately hashed password.
369      */

370     public String JavaDoc hashEncodePassword(String JavaDoc password) throws DBException;
371 } /* UserInfo */
372
Popular Tags