KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > admin > security > Security


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * -----------------------------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * -----------------------------------------------------------------------------
30  * $Log: Security.java,v $
31  * Revision 1.3 2005/04/10 19:42:41 colinmacleod
32  * *** empty log message ***
33  *
34  * Revision 1.2 2005/04/09 17:19:56 colinmacleod
35  * Changed copyright text to GPL v2 explicitly.
36  *
37  * Revision 1.1.1.1 2005/03/10 17:51:39 colinmacleod
38  * Restructured ivata op around Hibernate/PicoContainer.
39  * Renamed ivata groupware.
40  *
41  * Revision 1.4 2004/11/12 18:16:07 colinmacleod
42  * Ordered imports.
43  *
44  * Revision 1.3 2004/11/12 15:57:18 colinmacleod
45  * Removed dependencies on SSLEXT.
46  * Moved Persistence classes to ivata masks.
47  *
48  * Revision 1.2 2004/11/03 16:07:28 colinmacleod
49  * Many bugfixes.
50  * Added new addUser method.
51  *
52  * Revision 1.1 2004/09/30 15:15:58 colinmacleod
53  * Split off addressbook elements into security subproject.
54  *
55  * Revision 1.1 2004/07/13 19:41:11 colinmacleod
56  * Moved project to POJOs from EJBs.
57  * Applied PicoContainer to services layer (replacing session EJBs).
58  * Applied Hibernate to persistence layer (replacing entity EJBs).
59  * -----------------------------------------------------------------------------
60  */

61 package com.ivata.groupware.admin.security;
62
63 import javax.ejb.EJBException JavaDoc;
64
65 import com.ivata.groupware.admin.security.server.SecuritySession;
66 import com.ivata.groupware.admin.security.user.UserDO;
67 import com.ivata.mask.util.SystemException;
68
69 /**
70  * @author Colin MacLeod
71  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
72  * @since Mar 29, 2004
73  * @version $Revision: 1.3 $
74  */

75 public interface Security {
76     public String JavaDoc BUNDLE_PATH = "security";
77     /**
78      * <p>Add a new user to the system.</p>
79      *
80      * @param securitySession checks the current site user is allowed to perform
81      * the action
82      * @param user the user to be amended.
83      */

84     UserDO addUser(SecuritySession securitySession,
85             UserDO user)
86                 throws SystemException;
87
88     /**
89      * <p>Amend a user in the system.</p>
90      *
91      * @param securitySession checks the current site user is allowed to perform
92      * the action
93      * @param user the user to be amended.
94      */

95     void amendUser(SecuritySession securitySession,
96             UserDO user)
97                 throws SystemException;
98
99     /**
100      * <p>Check a password is correct for a user.</p>
101      *
102      * @param userName
103      * @param password
104      * @throws InvalidFieldValueException if any of the parameters are
105      * <code>null</code>.
106      * @throws InvalidFieldValueException if any of the parameters are
107      * <code>null</code>.
108      *
109      * @ejb.interface-method
110      * view-type = "remote"
111      */

112     void checkPassword(SecuritySession securitySession, String JavaDoc password)
113         throws SystemException;
114     /**
115      * Find a user given the user name.
116      *
117      * @param securitySession valid security session.
118      * @param userName name of the user to find.
119      */

120     UserDO findUserByName(SecuritySession securitySession, String JavaDoc userName)
121             throws SystemException;
122
123     /**
124      * <p>This method add prefix to username.</p>
125      *
126      * @param userName
127      * @return prefix_userName
128      *
129      * @ejb.interface-method
130      * view-type = "remote"
131      */

132     String JavaDoc getSystemUserName(final SecuritySession securitySession,
133             String JavaDoc userName)
134         throws SystemException;
135
136     /**
137      * <p>This method is converting SystemUserName to userName, it's oposite method to getSystemUserName.</p>
138      * @param systemUserName
139      * @return
140      *
141      * @ejb.interface-method
142      * view-type = "remote"
143      */

144     String JavaDoc getUserNameFromSystemUserName(final SecuritySession securitySession,
145             String JavaDoc systemUserName)
146         throws SystemException;
147
148     boolean isUser(SecuritySession securitySession,
149             String JavaDoc userNameParam) throws SystemException;
150     /**
151      * <p>Find out if a user is currently enabled
152      * @param userName
153      * @throws InvalidFieldValueException if <code>userName</code> is
154      * <code>null</code>.
155      * @return <code>true</code> if the user is currently enabled, otherwise
156      * <code>false</code>.
157      *
158      * @ejb.interface-method
159      * view-type = "remote"
160      */

161     boolean isUserEnabled(SecuritySession securitySession,
162         String JavaDoc userName)
163         throws SystemException;
164     /**
165      * <p>Login to the system. This method confirms the user name and password
166      * against system settings and logs the user into the mail server, if this
167      * is the desired form of authentication.</p>
168      *
169      * @param user to log into the remote system.
170      * @param password the clear-text password to log into the remote system.
171      * @throws EJBException if the person cannot log in.
172      * @return the mail server used to access the mail system, or
173      * <code>null</code> if another form of authentication is being used.
174      *
175      * @ejb.interface-method
176      * view-type = "remote"
177      */

178     SecuritySession login(UserDO user, String JavaDoc password)
179         throws SystemException;
180
181     /**
182      * @param userName
183      * @return
184      *
185      * @ejb.interface-method
186      * view-type = "remote"
187      */

188     String JavaDoc loginAgain(SecuritySession securitySession, String JavaDoc userName)
189         throws SystemException;
190
191     SecuritySession loginGuest()
192         throws SystemException;
193
194     /**
195      * <p>Remove a user from the system. <strong>Note:</strong> this can have dire
196      * consequences and will delete all entries this user has ever made in the
197      * system. Consider using <code>enableUser</code> instead.</p>
198      *
199      * @param userName the name of the user who is doing the removing. <strong>This
200      * is not the name of the user to be removed!</strong>
201      * @param userNameRemove the name of the user to be removed.
202      * @see #enableUser
203      * @throws InvalidFieldValueException if any of the parameters are
204      * <code>null</code>.
205      *
206      * @ejb.interface-method
207      * view-type = "remote"
208      */

209     void removeUser(SecuritySession securitySession,
210         String JavaDoc userNameRemove)
211         throws SystemException;
212
213     /**
214      * <p>Restore user is he was delted.</p>
215      * @param userName who is doing this operation
216      * @param restoreUserName who is going to be restored
217      *
218      * @ejb.interface-method
219      * view-type = "remote"
220      */

221     void restoreUser(SecuritySession securitySession,
222         String JavaDoc restoreUserName)
223         throws SystemException;
224     /**
225      * <p>Set the password of a user.</p>
226      *
227      * @param userName the name of the user who is changing the password in the
228      * system. <strong>This is not be the user name whose password is to be
229      * changed!</strong>
230      * @param userNamePassword the name of the user for whom to change the
231      * password.
232      * @param password the new value of the password (unencrypted) for the user.
233      * @throws InvalidFieldValueException if any of the parameters are
234      * <code>null</code>.
235      *
236      * @ejb.interface-method
237      * view-type = "remote"
238      */

239     void setPassword(
240         SecuritySession securitySession,
241         String JavaDoc userNamePassword,
242         String JavaDoc password)
243         throws SystemException;
244
245 }
Popular Tags