001: /* ====================================================================
002: * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
003: *
004: * Copyright (c) 1995-2002 Jcorporate Ltd. All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions
008: * are met:
009: *
010: * 1. Redistributions of source code must retain the above copyright
011: * notice, this list of conditions and the following disclaimer.
012: *
013: * 2. Redistributions in binary form must reproduce the above copyright
014: * notice, this list of conditions and the following disclaimer in
015: * the documentation and/or other materials provided with the
016: * distribution.
017: *
018: * 3. The end-user documentation included with the redistribution,
019: * if any, must include the following acknowledgment:
020: * "This product includes software developed by Jcorporate Ltd.
021: * (http://www.jcorporate.com/)."
022: * Alternately, this acknowledgment may appear in the software itself,
023: * if and wherever such third-party acknowledgments normally appear.
024: *
025: * 4. "Jcorporate" and product names such as "Expresso" must
026: * not be used to endorse or promote products derived from this
027: * software without prior written permission. For written permission,
028: * please contact info@jcorporate.com.
029: *
030: * 5. Products derived from this software may not be called "Expresso",
031: * or other Jcorporate product names; nor may "Expresso" or other
032: * Jcorporate product names appear in their name, without prior
033: * written permission of Jcorporate Ltd.
034: *
035: * 6. No product derived from this software may compete in the same
036: * market space, i.e. framework, without prior written permission
037: * of Jcorporate Ltd. For written permission, please contact
038: * partners@jcorporate.com.
039: *
040: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
041: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
042: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
043: * DISCLAIMED. IN NO EVENT SHALL JCORPORATE LTD OR ITS CONTRIBUTORS
044: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
045: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
046: * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
047: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
048: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
049: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
050: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
051: * SUCH DAMAGE.
052: * ====================================================================
053: *
054: * This software consists of voluntary contributions made by many
055: * individuals on behalf of the Jcorporate Ltd. Contributions back
056: * to the project(s) are encouraged when you make modifications.
057: * Please send them to support@jcorporate.com. For more information
058: * on Jcorporate Ltd. and its products, please see
059: * <http://www.jcorporate.com/>.
060: *
061: * Portions of this software are based upon other open source
062: * products and are subject to their respective licenses.
063: */
064:
065: package com.jcorporate.expresso.core.security;
066:
067: import com.jcorporate.expresso.core.db.DBException;
068: import com.jcorporate.expresso.core.dbobj.LookupInterface;
069:
070: import java.util.Vector;
071:
072: /**
073: * UserInfo defines the interface to an object that provides information about a user
074: * this object may get it's information from LDAP, Database, or any other source
075: *
076: * @author Michael Nash
077: */
078: public interface UserInfo extends LookupInterface {
079: /**
080: * Adds the current UserInfo object into the repository
081: *
082: * @throws DBException If the add fails
083: */
084: public void add() throws DBException;
085:
086: /**
087: * Deletes the current UserInfo object from the repository
088: *
089: * @throws DBException If the delete fails
090: */
091: public void delete() throws DBException;
092:
093: /**
094: * Find a UserInfo object in the repository that matches the non-empty properties filled in the current UserInfo object
095: *
096: * @return true if the user is found
097: * @throws DBException If the find fails
098: */
099: public boolean find() throws DBException;
100:
101: /**
102: * Retrieve the current account status. Valid values are "A" (active), "I" (inactive), "D" (disabled)
103: *
104: * @return java.lang.String
105: * @throws DBException If the find fails
106: */
107: public String getAccountStatus() throws DBException;
108:
109: /**
110: * Returns a Vector of all the UserInfo objects in the repository
111: *
112: * @return java.util.Vector
113: * @throws DBException If there is an error during the retrieval
114: */
115: public Vector getAllUsers() throws DBException;
116:
117: /**
118: * Returns the date that this UserInfo object was created
119: *
120: * @return java.lang.String
121: * @throws DBException If there is an error during the retrieval
122: */
123: public String getCreateDate() throws DBException;
124:
125: /**
126: * Returns the email address for this user
127: *
128: * @return java.lang.String
129: * @throws DBException If there is an error during the retrieval
130: */
131: public String getEmail() throws DBException;
132:
133: /**
134: * Returns the email auth code previously set for this user
135: *
136: * @return java.lang.String
137: * @throws DBException If there is an error during the retrieval
138: */
139: public String getEmailAuthCode() throws DBException;
140:
141: /**
142: * Retrieve the validation code required for authorization by email
143: *
144: * @return java.lang.String
145: * @throws DBException If the find fails
146: */
147: public String getEmailValCode() throws DBException;
148:
149: /**
150: * Return a vector of the group names that this user belongs to
151: *
152: * @param fieldName The field to retrieve
153: * @return Vector Group names that this user belongs to
154: * @throws DBException If an error occurs when the group info is read
155: * @deprecated Use the direct getLoginName, getEmail, getPassword, etc. methods instead
156: */
157: public String getField(String fieldName) throws DBException;
158:
159: /**
160: * Return a vector of the group names that this user belongs to
161: *
162: * @return Vector Group names that this user belongs to
163: * @throws DBException If an error occurs when the group info is read
164: */
165: public Vector getGroups() throws DBException;
166:
167: /**
168: * Returns the login name of this user
169: *
170: * @return java.lang.String
171: * @throws DBException If there is an error during the retrieval
172: */
173: public String getLoginName() throws DBException;
174:
175: /**
176: * Returns the password for this user
177: *
178: * @return java.lang.String
179: * @throws DBException If there is an error during the retrieval
180: */
181: public String getPassword() throws DBException;
182:
183: /**
184: * Returns the status of whether extended registration has been completed or not
185: * Valid values are "Y" or "N"
186: *
187: * @return java.lang.String
188: * @throws DBException If there is an error during the retrieval
189: */
190: public boolean getRegComplete() throws DBException;
191:
192: /**
193: * Returns the unique integer for the registration domain that this user belongs to
194: *
195: * @return java.lang.String
196: * @throws com.jcorporate.expresso.core.db.DBException
197: * If the underlying User implementation throws the same
198: */
199: public String getRegistrationDomain() throws DBException;
200:
201: /**
202: * Returns the user id for this user
203: *
204: * @return java.lang.String
205: * @throws DBException If there is an error during the retrieval
206: */
207: public int getUid() throws DBException;
208:
209: /**
210: * Returns the date that this UserInfo object was last modified
211: *
212: * @return java.lang.String
213: * @throws DBException If there is an error during the retrieval
214: */
215: public String getUpdateDate() throws DBException;
216:
217: /**
218: * Returns the descriptive string for this user
219: *
220: * @return java.lang.String
221: * @throws DBException If there is an error during the retrieval
222: */
223: public String getUserName() throws DBException;
224:
225: /**
226: * Checks if the given password equals what we have on file. We don't
227: * directly compare userInfo fields because often we store the password
228: * in a hash instead of a normal string so we have to take the testPassword,
229: * hash it and compare the two hashes.
230: *
231: * @param testPassword The string to test if it's a correct password
232: * @return true if the testPassword equals the password on file.
233: * @throws DBException If an error occurs when the group info is read
234: */
235: public boolean passwordEquals(String testPassword)
236: 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 accountStatus)
262: throws DBException;
263:
264: /**
265: * Sets the DB context
266: *
267: * @param newDBName java.lang.String
268: * @throws DBException If there is an error
269: */
270: public void setDBName(String newDBName) throws DBException;
271:
272: /**
273: * gets the DB context; can return null
274: *
275: * @deprecated since 5.6, use getDataContext() instead
276: */
277: public String getDBName();
278:
279: /**
280: * gets the DB context; can return null
281: */
282: public String getDataContext();
283:
284: /**
285: * Sets the email address
286: *
287: * @param email java.lang.String
288: * @throws DBException If there is an error
289: */
290: public void setEmail(String email) throws DBException;
291:
292: /* setEmailValCode(String) */
293: /**
294: * Sets the code required for auth. via email
295: *
296: * @param code java.lang.String
297: * @throws DBException If there is an error
298: */
299: public void setEmailValCode(String code) throws DBException;
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 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 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 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 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 getPrimaryGroup() throws DBException;
364:
365: /**
366: * this returns an appropriately hashed password.
367: *
368: * @return appropriately hashed password.
369: */
370: public String hashEncodePassword(String password)
371: throws DBException;
372: } /* UserInfo */
|