1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.security.spi;
18
19 import java.security.Principal;
20 import java.util.List;
21
22 import org.apache.jetspeed.security.SecurityException;
23 import org.apache.jetspeed.security.UserPrincipal;
24
25 /***
26 * <p>
27 * This interface encapsulates the persistence of a user security.
28 * </p>
29 * <p>
30 * This provides a central placeholder for changing the persistence of user
31 * security information.
32 * </p>
33 * <p>
34 * A security implementation wanting to store user security implementation in
35 * LDAP for instance would need to provide an LDAP implementation of this
36 * interface.
37 * </p>
38 *
39 * @author <a href="mailto:dlestrat@apache.org">David Le Strat </a>
40 */
41 public interface UserSecurityHandler
42 {
43 /***
44 * <p>
45 * Checks if a UserPrincipal exists
46 * @param userName
47 * @return true if a UserPrincipal exists
48 */
49 boolean isUserPrincipal(String userName);
50
51 /***
52 * <p>
53 * Gets the user principal for the given user name.
54 * </p>
55 *
56 * @param username The user name.
57 * @return The <code>Principal</p>
58 */
59 Principal getUserPrincipal(String username);
60
61 /***
62 * <p>
63 * Gets the an iterator of user principals for a given filter.
64 * </p>
65 *
66 * @param filter The filter.
67 * @return The list of <code>Principal</code>
68 */
69 List getUserPrincipals(String filter);
70
71 /***
72 * <p>
73 * Adds a new user principal in the backing store.
74 * </p>
75 *
76 * @param userPrincipal The new <code>UserPrincipal</code>.
77 * @throws SecurityException Throws a {@link SecurityException}.
78 */
79 void addUserPrincipal(UserPrincipal userPrincipal) throws SecurityException;
80
81 /***
82 * <p>
83 * Updates the user principal in the backing store.
84 * </p>
85 *
86 * @param userPrincipal The <code>UserPrincipal</code>.
87 * @throws SecurityException Throws a {@link SecurityException}.
88 */
89 void updateUserPrincipal(UserPrincipal userPrincipal) throws SecurityException;
90
91 /***
92 * <p>
93 * Removes the user principal.
94 * </p>
95 *
96 * @param userPrincipal The <code>UserPrincipal</code>.
97 * @throws SecurityException Throws a {@link SecurityException}.
98 */
99 void removeUserPrincipal(UserPrincipal userPrincipal) throws SecurityException;
100 }