2 * Copyright 2005-2010 the original author or authors.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.wamblee.security.authentication;
21 * Represents a set of users. Typical implementations would be an implementation
22 * based on a static configuration file or an implementation backed by a
25 * @author Erik Brakkee
27 public interface UserSet {
38 * @throws UserMgtException
39 * In case the user cannot be created.
41 User createUser(String aUsername, String aPassword)
42 throws UserMgtException;
45 * Must be called whenever a user object has been modified to notify the
51 void userModified(User aUser);
59 * @return User or null if not found.
61 User find(String aName);
64 * Checks if a user exists.
69 * @return True iff the user exists.
71 boolean contains(User aUser);
74 * Adds a user. If the user already exists, the user details are updated
75 * with that of the specified user object.
81 boolean add(User aUser);
86 * @param aUser User to remove
87 * @return True iff user was removed.
90 boolean remove(User aUser);
93 * Lists the current users.
100 * Lists the users belonging to a particular group.
106 Set<User> list(Group aGroup);
110 * @return The number of users.
115 * Clears the user cache.