org.wamblee.security.authentication
Interface UserSet

All Known Implementing Classes:
AbstractUserSet, InMemoryUserSet, JpaUserSet

public interface UserSet

Represents a set of users. Typical implementations would be an implementation based on a static configuration file or an implementation backed by a database.

Author:
Erik Brakkee

Method Summary
 boolean add(User aUser)
          Adds a user.
 void clearCache()
          Clears the user cache.
 boolean contains(User aUser)
          Checks if a user exists.
 User createUser(java.lang.String aUsername, java.lang.String aPassword)
          Creates a user.
 User find(java.lang.String aName)
          Finds user.
 java.util.Set<User> list()
          Lists the current users.
 java.util.Set<User> list(Group aGroup)
          Lists the users belonging to a particular group.
 boolean remove(User aUser)
          Removes a user.
 int size()
           
 void userModified(User aUser)
          Must be called whenever a user object has been modified to notify the user set.
 

Method Detail

createUser

User createUser(java.lang.String aUsername,
                java.lang.String aPassword)
                throws UserMgtException
Creates a user.

Parameters:
aUsername - User name.
aPassword - Password.
Returns:
New user.
Throws:
UserMgtException - In case the user cannot be created.

userModified

void userModified(User aUser)
Must be called whenever a user object has been modified to notify the user set.

Parameters:
aUser - Modified user.

find

User find(java.lang.String aName)
Finds user.

Parameters:
aName - Username.
Returns:
User or null if not found.

contains

boolean contains(User aUser)
Checks if a user exists.

Parameters:
aUser - User.
Returns:
True iff the user exists.

add

boolean add(User aUser)
Adds a user. If the user already exists, the user details are updated with that of the specified user object.

Parameters:
aUser - User to add.

remove

boolean remove(User aUser)
Removes a user.

Parameters:
aUser - User to remove
Returns:
True iff user was removed.

list

java.util.Set<User> list()
Lists the current users.

Returns:
Users.

list

java.util.Set<User> list(Group aGroup)
Lists the users belonging to a particular group.

Parameters:
aGroup - Group.
Returns:
Groups.

size

int size()
Returns:
The number of users.

clearCache

void clearCache()
Clears the user cache.



Copyright © 2022. All Rights Reserved.