org.wamblee.security.authentication
Class InMemoryUserSet

java.lang.Object
  extended by org.wamblee.security.authentication.AbstractUserSet
      extended by org.wamblee.security.authentication.InMemoryUserSet
All Implemented Interfaces:
UserSet

public class InMemoryUserSet
extends AbstractUserSet

In-memory user set.

Author:
Erik Brakkee

Constructor Summary
InMemoryUserSet(NameValidator aPasswordValidator, MessageDigester aPasswordEncoder)
          Constructs an empty user set.
 
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 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.
 
Methods inherited from class org.wamblee.security.authentication.AbstractUserSet
createUser, setPasswordInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InMemoryUserSet

public InMemoryUserSet(NameValidator aPasswordValidator,
                       MessageDigester aPasswordEncoder)
Constructs an empty user set.

Method Detail

userModified

public void userModified(User aUser)
Description copied from interface: UserSet
Must be called whenever a user object has been modified to notify the user set.

Parameters:
aUser - Modified user.

find

public User find(java.lang.String aName)
Description copied from interface: UserSet
Finds user.

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

add

public boolean add(User aUser)
Description copied from interface: UserSet
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.

contains

public boolean contains(User aUser)
Description copied from interface: UserSet
Checks if a user exists.

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

remove

public boolean remove(User aUser)
Description copied from interface: UserSet
Removes a user.

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

list

public java.util.Set<User> list()
Description copied from interface: UserSet
Lists the current users.

Returns:
Users.

list

public java.util.Set<User> list(Group aGroup)
Description copied from interface: UserSet
Lists the users belonging to a particular group.

Parameters:
aGroup - Group.
Returns:
Groups.

size

public int size()
Returns:
The number of users.

clearCache

public void clearCache()
Description copied from interface: UserSet
Clears the user cache.



Copyright © 2022. All Rights Reserved.