1 package org.apache.turbine.services.security.ldap;
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.Hashtable;
58 import java.util.Vector;
59 import org.apache.torque.util.Criteria;
60 import org.apache.turbine.om.security.Group;
61 import org.apache.turbine.om.security.Permission;
62 import org.apache.turbine.om.security.Role;
63 import org.apache.turbine.om.security.User;
64 import org.apache.turbine.services.security.BaseSecurityService;
65 import org.apache.turbine.util.security.AccessControlList;
66 import org.apache.turbine.util.security.DataBackendException;
67 import org.apache.turbine.util.security.EntityExistsException;
68 import org.apache.turbine.util.security.GroupSet;
69 import org.apache.turbine.util.security.PermissionSet;
70 import org.apache.turbine.util.security.RoleSet;
71 import org.apache.turbine.util.security.UnknownEntityException;
72
73 /***
74 * An implementation of SecurityService that uses LDAP as a backend.
75 *
76 * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
77 * @author <a href="mailto:tadewunmi@gluecode.com">Tracy M. Adewunmi </a>
78 * @author <a href="mailto:lflournoy@gluecode.com">Leonard J. Flournoy </a>
79 * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
80 * @author <a href="mailto:marco@intermeta.de">Marco Knüttel</a>
81 * @version $Id: LDAPSecurityService.java,v 1.5 2002/07/11 16:53:24 mpoeschl Exp $
82 */
83 public class LDAPSecurityService extends BaseSecurityService
84 {
85 /*
86 * -----------------------------------------------------------------------
87 * C R E A T I O N O F A C C E S S C O N T R O L L I S T
88 * -----------------------------------------------------------------------
89 */
90
91 /***
92 * Constructs an AccessControlList for a specific user.
93 *
94 * This method creates a snapshot of the state of security information
95 * concerning this user, at the moment of invocation and stores it
96 * into an AccessControlList object.
97 *
98 * @param user the user for whom the AccessControlList are to be retrieved
99 * @throws DataBackendException if there was an error accessing the data backend.
100 * @throws UnknownEntityException if user account is not present.
101 */
102 public AccessControlList getACL(User user)
103 throws DataBackendException, UnknownEntityException
104 {
105 /*
106 * This is severely lacking [jvz].
107 */
108 Hashtable roles = new Hashtable();
109 Hashtable permissions = new Hashtable();
110 return new AccessControlList(roles, permissions);
111 }
112
113 /*
114 * -----------------------------------------------------------------------
115 * S E C U R I T Y M A N A G E M E N T
116 * -----------------------------------------------------------------------
117 */
118
119 /***
120 * Grant an User a Role in a Group.
121 *
122 * @param User the user.
123 * @param Group the group.
124 * @param Role the role.
125 * @throws DataBackendException if there was an error accessing the data backend.
126 * @throws UnknownEntityException if user account, group or role is not present.
127 */
128 public synchronized void grant(User user, Group group, Role role)
129 throws DataBackendException, UnknownEntityException
130 {
131 }
132
133 /***
134 * Revoke a Role in a Group from an User.
135 *
136 * @param User the user.
137 * @param Group the group.
138 * @param Role the role.
139 * @throws DataBackendException if there was an error accessing the data backend.
140 * @throws UnknownEntityException if user account, group or role is not present.
141 */
142 public synchronized void revoke(User user, Group group, Role role)
143 throws DataBackendException, UnknownEntityException
144 {
145 }
146
147 /***
148 * Grants a Role a Permission
149 *
150 * @param role the Role.
151 * @param permission the Permission.
152 * @throws DataBackendException if there was an error accessing the data backend.
153 * @throws UnknownEntityException if role or permission is not present.
154 */
155 public synchronized void grant(Role role, Permission permission)
156 throws DataBackendException, UnknownEntityException
157 {
158 }
159
160 /***
161 * Revokes a Permission from a Role.
162 *
163 * @param role the Role.
164 * @param permission the Permission.
165 * @throws DataBackendException if there was an error accessing the data backend.
166 * @throws UnknownEntityException if role or permission is not present.
167 */
168 public synchronized void revoke(Role role, Permission permission)
169 throws DataBackendException, UnknownEntityException
170 {
171 }
172
173 /*
174 * -----------------------------------------------------------------------
175 * G R O U P / R O L E / P E R M I S S I O N M A N A G E M E N T
176 * -----------------------------------------------------------------------
177 */
178
179 /***
180 * Retrieves a new Group. It creates
181 * a new Group based on the Services Group implementation. It does not
182 * create a new Group in the system though. Use addGroup for that.
183 * <strong>Not implemented</strong>
184 *
185 * @param groupName The name of the Group to be retrieved.
186 */
187 public Group getNewGroup( String groupName )
188 {
189 // Not implemented
190 return null;
191 }
192
193 /***
194 * Retrieves a new Role. It creates
195 * a new Role based on the Services Role implementation. It does not
196 * create a new Role in the system though. Use addRole for that.
197 * <strong>Not implemented</strong>
198 *
199 * @param groupName The name of the Group to be retrieved.
200 */
201 public Role getNewRole(String roleName)
202 {
203 // Not implemented
204 return null;
205 }
206
207 /***
208 * Retrieves a new Permission. It creates
209 * a new Permission based on the Services Permission implementation. It does not
210 * create a new Permission in the system though. Use create for that.
211 * <strong>Not implemented</strong>
212 *
213 * @param permissionName The name of the Permission to be retrieved.
214 */
215 public Permission getNewPermission( String permissionName )
216 {
217 // Not implemented
218 return null;
219 }
220
221 /***
222 * Retrieve a set of Groups that meet the specified Criteria.
223 *
224 * @param a Criteria of Group selection.
225 * @return a set of Groups that meet the specified Criteria.
226 */
227 public GroupSet getGroups(Criteria criteria) throws DataBackendException
228 {
229 Vector groups = new Vector(0);
230 return new GroupSet(groups);
231 }
232
233 /***
234 * Retrieve a set of Roles that meet the specified Criteria.
235 *
236 * @param a Criteria of Roles selection.
237 * @return a set of Roles that meet the specified Criteria.
238 */
239 public RoleSet getRoles(Criteria criteria) throws DataBackendException
240 {
241 Vector roles = new Vector(0);
242 return new RoleSet(roles);
243 }
244
245 /***
246 * Retrieve a set of Permissions that meet the specified Criteria.
247 *
248 * @param a Criteria of Permissions selection.
249 * @return a set of Permissions that meet the specified Criteria.
250 */
251 public PermissionSet getPermissions(Criteria criteria)
252 throws DataBackendException
253 {
254 Vector permissions = new Vector(0);
255 return new PermissionSet(permissions);
256 }
257
258 /***
259 * Retrieves all permissions associated with a role.
260 *
261 * @param role the role name, for which the permissions are to be retrieved.
262 * @throws DataBackendException if there was an error accessing the data backend.
263 * @throws UnknownEntityException if the role is not present.
264 */
265 public PermissionSet getPermissions(Role role)
266 throws DataBackendException, UnknownEntityException
267 {
268 return new PermissionSet();
269 }
270
271 /***
272 * Stores Group's attributes. The Groups is required to exist in the system.
273 *
274 * @param group The Group to be stored.
275 * @throws DataBackendException if there was an error accessing the data backend.
276 * @throws UnknownEntityException if the group does not exist.
277 */
278 public void saveGroup(Group group) throws DataBackendException,
279 UnknownEntityException
280 {
281 }
282
283 /***
284 * Stores Role's attributes. The Roles is required to exist in the system.
285 *
286 * @param role The Role to be stored.
287 * @throws DataBackendException if there was an error accessing the data backend.
288 * @throws UnknownEntityException if the role does not exist.
289 */
290 public void saveRole(Role role) throws DataBackendException,
291 UnknownEntityException
292 {
293 }
294
295 /***
296 * Stores Permission's attributes. The Permissions is required to exist in the system.
297 *
298 * @param permission The Permission to be stored.
299 * @throws DataBackendException if there was an error accessing the data backend.
300 * @throws UnknownEntityException if the permission does not exist.
301 */
302 public void savePermission(Permission permission)
303 throws DataBackendException, UnknownEntityException
304 {
305 }
306
307 /***
308 * Creates a new group with specified attributes.
309 * <strong>Not implemented</strong>
310 *
311 * @param group the object describing the group to be created.
312 * @return a new Group object that has id set up properly.
313 * @throws DataBackendException if there was an error accessing the data backend.
314 * @throws EntityExistsException if the group already exists.
315 */
316 public synchronized Group addGroup(Group group)
317 throws DataBackendException, EntityExistsException
318 {
319 // Not implemented
320 return null;
321 }
322
323 /***
324 * Creates a new role with specified attributes.
325 *
326 * @param role the object describing the role to be created.
327 * @return a new Role object that has id set up properly.
328 * @throws DataBackendException if there was an error accessing the data backend.
329 * @throws EntityExistsException if the role already exists.
330 */
331 public synchronized Role addRole(Role role)
332 throws DataBackendException, EntityExistsException
333 {
334 return null;
335 //return new Role();
336 }
337
338 /***
339 * Creates a new permission with specified attributes.
340 * <strong>Not implemented</strong>
341 *
342 * @param permission the object describing the permission to be created.
343 * @return a new Permission object that has id set up properly.
344 * @throws DataBackendException if there was an error accessing the data backend.
345 * @throws EntityExistsException if the permission already exists.
346 */
347 public synchronized Permission addPermission(Permission permission)
348 throws DataBackendException, EntityExistsException
349 {
350 // Not implemented
351 return null;
352 }
353
354 /***
355 * Removes a Group from the system.
356 *
357 * @param the object describing group to be removed.
358 * @throws DataBackendException if there was an error accessing the data backend.
359 * @throws UnknownEntityException if the group does not exist.
360 */
361 public synchronized void removeGroup(Group group)
362 throws DataBackendException, UnknownEntityException
363 {
364 }
365
366 /***
367 * Removes a Role from the system.
368 *
369 * @param the object describing role to be removed.
370 * @throws DataBackendException if there was an error accessing the data backend.
371 * @throws UnknownEntityException if the role does not exist.
372 */
373 public synchronized void removeRole(Role role)
374 throws DataBackendException, UnknownEntityException
375 {
376 }
377
378 /***
379 * Removes a Permission from the system.
380 *
381 * @param the object describing permission to be removed.
382 * @throws DataBackendException if there was an error accessing the data backend.
383 * @throws UnknownEntityException if the permission does not exist.
384 */
385 public synchronized void removePermission(Permission permission)
386 throws DataBackendException, UnknownEntityException
387 {
388 }
389
390 /***
391 * Renames an existing Group.
392 *
393 * @param the object describing the group to be renamed.
394 * @param name the new name for the group.
395 * @throws DataBackendException if there was an error accessing the data backend.
396 * @throws UnknownEntityException if the group does not exist.
397 */
398 public synchronized void renameGroup(Group group, String name)
399 throws DataBackendException, UnknownEntityException
400 {
401 }
402
403 /***
404 * Renames an existing Role.
405 *
406 * @param the object describing the role to be renamed.
407 * @param name the new name for the role.
408 * @throws DataBackendException if there was an error accessing the data backend.
409 * @throws UnknownEntityException if the role does not exist.
410 */
411 public synchronized void renameRole(Role role, String name)
412 throws DataBackendException, UnknownEntityException
413 {
414 }
415
416 /***
417 * Renames an existing Permission.
418 *
419 * @param the object describing the permission to be renamed.
420 * @param name the new name for the permission.
421 * @throws DataBackendException if there was an error accessing the data backend.
422 * @throws UnknownEntityException if the permission does not exist.
423 */
424 public synchronized void renamePermission(Permission permission,
425 String name)
426 throws DataBackendException, UnknownEntityException
427 {
428 }
429
430 //just to satisify the interface requirements
431 public void revokeAll(User user)
432 {
433 }
434
435 //just to satisify the interface requirements
436 public void revokeAll(Role role)
437 {
438 }
439
440 //just to satisify the interface requirements
441 public void revokeAll(Group group)
442 {
443 }
444 }
This page was automatically generated by Maven