pt.digitalis.dif.controller.security.managers
Interface IIdentityManager

All Known Subinterfaces:
IIdentityManagerPrivate
All Known Implementing Classes:
AbstractIdentityManager, IdentityManagerStaticImpl

public interface IIdentityManager

Defines the expected behavior for an identity manager. This manager supports users IDIFUser and groups IDIFGroup.

Author:
Rodrigo Gon�alves rgoncalves@digitalis.pt
, Luis Pinto lpinto@digitalis.pt
, Pedro Viegas pviegas@digitalis.pt
, Fábio Souto fsouto@digitalis.pt
Created on:
2007/12/04

Method Summary
 void addGroup(IDIFGroup newGroup)
          Adds a new group to the manager.
 void addManagedAttribute(String attribute)
          Adds a managed attribute.
 void addManagedAttributes(String attributes)
          Adds a comma-separated list of managed attributes.
 void addUser(IDIFUser newUser)
          Adds a new user to the manager.
 void addUserToGroup(String userID, String groupID)
          Adds an existing user to an existing group.
 void changePassword(String userID, String newPassword)
          Changes the password for the supplied user.
 boolean containsUserParameter(String userID, String parameterID)
          Checks if a parameter exists.
 int countAllGroups()
          Counts the number of groups in the system
 int countAllGroupsOfUser(String userId)
          Counts all groups of a given user.
 int countAllGroupsOfUser(String userId, boolean parseGroupHierarchy)
          Counts all groups of a given user.
 int countAllUsers()
          Counts the number of users in the system
 int countAllUsers(String groupId)
          Counts all users of a given group.
 int countUsers(Map<String,String> attributes)
          Count the number of users in the system which match all of the provided attributes
 List<String> gatherManagedAttributes()
          Gathers the managed attributes.
 Set<IDIFGroup> getAllGroups()
          Get all the groups registered in the system
 Set<IDIFUser> getAllUsers()
          Get all the users in the system
 String getExclusionCharaters()
          Get the exclusion charaters
 IDIFGroup getGroup(String groupID)
          Gets a group from its id, if it exists.
 String getGroupAttributeName()
          Gets the group attribute name
 Map<String,IDIFGroup> getGroupGroups(String parentGroupID)
          Returns the list of groups whose parent group is the given group
 Set<IDIFGroup> getGroups(Pagination page)
          Returns a subset of all groups in the system, according to the parameters
 Map<String,IDIFUser> getGroupUsers(String groupID)
          Returns the list of users of a given group
 String getMailAttributeName()
          Gets the mail attribute name
 List<String> getManagedAttributes()
          Gets the framework managed attributes.
 String getNameAttributeName()
          Gets the name attribute name
 IDIFUser getUser(String userID)
          Gets an user from its id, if it exists.
 Map<String,IDIFGroup> getUserGroups(String userID)
          Returns the list of groups of a given user
 Map<String,IDIFGroup> getUserGroups(String userID, boolean parseGroupHierarchy)
          Returns the list of groups of a given user
 Set<String> getUserGroupsIDs(String userID)
          Returns the list of group IDs of a given user
 Set<String> getUserGroupsIDs(String userID, boolean parseGroupHierarchy)
          Returns the list of group IDs of a given user
 Map<String,IDIFGroup> getUserGroupsPagination(String userID, Pagination page)
          Returns the list of groups of a given user, with pagination.
 Set<String> getUserIDsInGroup(String groupID)
          Returns the list of user IDs of a given group
 String getUserLoginAttributeName()
          Gets the user login attribute name
 Object getUserParameter(String userID, String parameterID)
          Gets a given parameter from a given user.
 Map<String,Object> getUserParameters(String userID)
          Gets all the parameters from a given user.
 String getUserParentGroupAttributeName()
          Returns the user parent group attribute name
 Set<IDIFUser> getUsers(Pagination page)
          Returns a subset of all users in the system, according to the parameters
 Set<IDIFUser> getUsersByAttribute(String attribute, String value)
          Returns the list of users with a given attribute value.
 Set<IDIFUser> getUsersByAttributes(Map<String,String> attributes)
          Get users that match specified attributes.
 Set<IDIFUser> getUsersByAttributes(Map<String,String> attributes, Pagination page)
          Get users that match specified attributes.
 Set<IDIFUser> getUsersByEmail(String value)
          Returns the list of users with a given email attribute value.
 boolean groupExists(String groupID)
          Checks if a group exists on the manager.
 boolean isIdentityValid(String userID, String suppliedPassword)
          Checks if the supplied password matches the one defined for a user with a given ID.
 boolean isReadOnly()
          Get the ldap readOnly configuration value.
 boolean isUserInGroup(String userID, String groupID)
          Checks if a given user belongs to a given group.
 boolean isUserInGroup(String userID, String groupID, boolean parseGroupHierarchy)
          Checks if a given user belongs to a given group.
 void removeGroup(String groupID)
          Removes an existing group from the manager, if it exists.
 void removeUser(String userID)
          Removes an existing user from the manager, if it exists.
 void removeUserFromGroup(String userID, String groupID)
          Removes an existing user from an existing group.
 void removeUserParameter(String userID, String parameterID)
          Removes a given parameter from a given user.
 void resetIdentityManager()
          Resets the identity manager.
 void setUserParameter(String userID, String parameterID, Object parameterValue)
          Sets an user parameter.
 void setUserParameters(String userID, Map<String,Object> parametersMap)
          Sets the user parameters as an whole.
 void updateGroup(IDIFGroup existingGroup)
          Updates an existing group.
 void updateUser(IDIFUser existingUser, String userID)
          Updates an existing user.
 void updateUserAttribute(String userID, String attributeID, Object attributeValue)
          Updates an attribute value on a given user and persists it.
 void updateUserAttributes(String userID, Map<String,Object> attributes)
          Updates all of the user's attributes.
 boolean userExists(String userID)
          Checks if a user exists on the manager.
 

Method Detail

addGroup

void addGroup(IDIFGroup newGroup)
              throws IdentityManagerException
Adds a new group to the manager.

Parameters:
newGroup - the group to add
Throws:
IdentityManagerException - if the user can't be added

addManagedAttribute

void addManagedAttribute(String attribute)
Adds a managed attribute.

Parameters:
attribute - The attribute

addManagedAttributes

void addManagedAttributes(String attributes)
Adds a comma-separated list of managed attributes.

Parameters:
attributes - The comma-separated list of managed attributes.

addUser

void addUser(IDIFUser newUser)
             throws IdentityManagerException
Adds a new user to the manager.

Parameters:
newUser - the new user to add to the manager
Throws:
IdentityManagerException - if the user can't be added

addUserToGroup

void addUserToGroup(String userID,
                    String groupID)
                    throws IdentityManagerException
Adds an existing user to an existing group.

Parameters:
groupID - the group ID
userID - the user ID
Throws:
IdentityManagerException - if the user can't be added to the group

changePassword

void changePassword(String userID,
                    String newPassword)
                    throws IdentityManagerException
Changes the password for the supplied user.

Parameters:
userID - the user ID
newPassword - the new password
Throws:
IdentityManagerException - if the password can't be changed

containsUserParameter

boolean containsUserParameter(String userID,
                              String parameterID)
Checks if a parameter exists.

Parameters:
userID - the user ID
parameterID - the parameter ID
Returns:
T if the parameter exists, F otherwise

countAllGroups

int countAllGroups()
                   throws IdentityManagerException
Counts the number of groups in the system

Returns:
The number of groups in the system
Throws:
IdentityManagerException - * If the operation cannot be executed

countAllGroupsOfUser

int countAllGroupsOfUser(String userId)
                         throws IdentityManagerException
Counts all groups of a given user.

Parameters:
userId - The user identifier
Returns:
The number of groups of this user.
Throws:
IdentityManagerException

countAllGroupsOfUser

int countAllGroupsOfUser(String userId,
                         boolean parseGroupHierarchy)
                         throws IdentityManagerException
Counts all groups of a given user.

Parameters:
userId - The user identifier
parseGroupHierarchy - contemplates the group Hierarchy
Returns:
The number of groups of this user.
Throws:
IdentityManagerException

countAllUsers

int countAllUsers()
                  throws IdentityManagerException
Counts the number of users in the system

Returns:
The number of users on the system
Throws:
IdentityManagerException - If the operation cannot be executed

countAllUsers

int countAllUsers(String groupId)
                  throws IdentityManagerException
Counts all users of a given group.

Parameters:
groupId - The group identifier
Returns:
The number of users of this group.
Throws:
IdentityManagerException

countUsers

int countUsers(Map<String,String> attributes)
               throws IdentityManagerException
Count the number of users in the system which match all of the provided attributes

Parameters:
attributes - The attributes
Returns:
The number of users in the system which match all of the provided attributes
Throws:
IdentityManagerException - If the operation cannot be executed

gatherManagedAttributes

List<String> gatherManagedAttributes()
Gathers the managed attributes. This method must be used to initialize the managed attributes.

Returns:
The list containing the managed attributes

getAllGroups

Set<IDIFGroup> getAllGroups()
                            throws IdentityManagerException
Get all the groups registered in the system

Returns:
A set containing all the groups
Throws:
IdentityManagerException - If the operation cannot be executed

getAllUsers

Set<IDIFUser> getAllUsers()
                          throws IdentityManagerException
Get all the users in the system

Returns:
A set containing all the users
Throws:
IdentityManagerException - If the operation cannot be executed

getExclusionCharaters

String getExclusionCharaters()
Get the exclusion charaters

Returns:
value

getGroup

IDIFGroup getGroup(String groupID)
                   throws IdentityManagerException
Gets a group from its id, if it exists.

Parameters:
groupID - the group id
Returns:
the group with the given id if it exists, null otherwise
Throws:
IdentityManagerException - if the group can't be found

getGroupAttributeName

String getGroupAttributeName()
Gets the group attribute name

Returns:
The string containing the attribute name

getGroupGroups

Map<String,IDIFGroup> getGroupGroups(String parentGroupID)
                                     throws IdentityManagerException
Returns the list of groups whose parent group is the given group

Parameters:
parentGroupID - the parent group to search for children groups
Returns:
the list of groups
Throws:
IdentityManagerException - if the group's groups can't be found

getGroups

Set<IDIFGroup> getGroups(Pagination page)
                         throws IdentityManagerException
Returns a subset of all groups in the system, according to the parameters

Parameters:
page - The required page
Returns:
A set of groups containing the specified subset
Throws:
IdentityManagerException - If the operation can't be executed

getGroupUsers

Map<String,IDIFUser> getGroupUsers(String groupID)
                                   throws IdentityManagerException
Returns the list of users of a given group

Parameters:
groupID - the group
Returns:
the list of users
Throws:
IdentityManagerException - if the operation can't be executed

getMailAttributeName

String getMailAttributeName()
Gets the mail attribute name

Returns:
The string containing the attribute name.

getManagedAttributes

List<String> getManagedAttributes()
Gets the framework managed attributes.

Returns:
the managedAttributes value

getNameAttributeName

String getNameAttributeName()
Gets the name attribute name

Returns:
The string containing the attribute name.

getUser

IDIFUser getUser(String userID)
                 throws IdentityManagerException
Gets an user from its id, if it exists.

Parameters:
userID - the user id
Returns:
the user that matches the supplied id if it exists, null otherwise
Throws:
IdentityManagerException - if the user can't be fetched

getUserGroups

Map<String,IDIFGroup> getUserGroups(String userID)
                                    throws IdentityManagerException
Returns the list of groups of a given user

Parameters:
userID - the user
Returns:
the list of groups
Throws:
IdentityManagerException - if the group's users can't be found

getUserGroups

Map<String,IDIFGroup> getUserGroups(String userID,
                                    boolean parseGroupHierarchy)
                                    throws IdentityManagerException
Returns the list of groups of a given user

Parameters:
userID - the user
parseGroupHierarchy - contemplates the group Hierarchy
Returns:
the list of groups
Throws:
IdentityManagerException - if the group's users can't be found

getUserGroupsIDs

Set<String> getUserGroupsIDs(String userID)
                             throws IdentityManagerException
Returns the list of group IDs of a given user

Parameters:
userID - the user
Returns:
the list of groups
Throws:
IdentityManagerException - if the group's users can't be found

getUserGroupsIDs

Set<String> getUserGroupsIDs(String userID,
                             boolean parseGroupHierarchy)
                             throws IdentityManagerException
Returns the list of group IDs of a given user

Parameters:
userID - the user
parseGroupHierarchy - contemplates the group Hierarchy
Returns:
the list of groups
Throws:
IdentityManagerException - if the group's users can't be found

getUserGroupsPagination

Map<String,IDIFGroup> getUserGroupsPagination(String userID,
                                              Pagination page)
                                              throws IdentityManagerException
Returns the list of groups of a given user, with pagination. This method doesn't consider the profile as a group.

Parameters:
userID - the user
page - The page to be returned
Returns:
the list of groups
Throws:
IdentityManagerException - if the group's users can't be found

getUserIDsInGroup

Set<String> getUserIDsInGroup(String groupID)
                              throws IdentityManagerException
Returns the list of user IDs of a given group

Parameters:
groupID - the group
Returns:
the list of users
Throws:
IdentityManagerException - if the operation can't be executed

getUserLoginAttributeName

String getUserLoginAttributeName()
Gets the user login attribute name

Returns:
The string containing the attribute name.

getUserParameter

Object getUserParameter(String userID,
                        String parameterID)
Gets a given parameter from a given user.

Parameters:
userID -
parameterID -
Returns:
the parameter value if it exists, null otherwise

getUserParameters

Map<String,Object> getUserParameters(String userID)
Gets all the parameters from a given user.

Parameters:
userID - the user ID
Returns:
the parameters map if it exists, null otherwise

getUserParentGroupAttributeName

String getUserParentGroupAttributeName()
Returns the user parent group attribute name

Returns:
A string containing the user parent group attribute name

getUsers

Set<IDIFUser> getUsers(Pagination page)
                       throws IdentityManagerException
Returns a subset of all users in the system, according to the parameters

Parameters:
page - The required page
Returns:
A set of users containing the specified subset
Throws:
IdentityManagerException - If the operation can't be executed

getUsersByAttribute

Set<IDIFUser> getUsersByAttribute(String attribute,
                                  String value)
                                  throws IdentityManagerException
Returns the list of users with a given attribute value.
Supports partial matches by adding "%" or "*" before and/or after the attribute value

Parameters:
attribute - the attribute to search
value - the value for the attribute
Returns:
the LDAPUser with the given login name
Throws:
IdentityManagerException - if the operation cannot be executed

getUsersByAttributes

Set<IDIFUser> getUsersByAttributes(Map<String,String> attributes)
                                   throws IdentityManagerException
Get users that match specified attributes.
Supports partial matches by adding "%" or "*" before and/or after the attribute value

Parameters:
attributes - A map of attributes to be searched, where the keys are the attribute names, and the values are the attribute values.
Returns:
A set containing the users that obey all of the specified criteria
Throws:
IdentityManagerException - If the operation can't be executed

getUsersByAttributes

Set<IDIFUser> getUsersByAttributes(Map<String,String> attributes,
                                   Pagination page)
                                   throws IdentityManagerException
Get users that match specified attributes.
Supports partial matches by adding "%" or "*" before and/or after the attribute value

Parameters:
attributes - A map of attributes to be searched, where the keys are the attribute names, and the values are the attribute values.
page - The page to be obtained
Returns:
A set containing the users that obey all of the specified criteria
Throws:
IdentityManagerException - If the operation can't be executed

getUsersByEmail

Set<IDIFUser> getUsersByEmail(String value)
                              throws IdentityManagerException
Returns the list of users with a given email attribute value.

Parameters:
value - the value for the attribute email
Returns:
the LDAPUser with the given login name
Throws:
IdentityManagerException - if the operation cannot be executed

groupExists

boolean groupExists(String groupID)
                    throws IdentityManagerException
Checks if a group exists on the manager.

Parameters:
groupID - the ID of the group
Returns:
T if the group exists, F otherwise
Throws:
IdentityManagerException - if the operation can't be executed

isIdentityValid

boolean isIdentityValid(String userID,
                        String suppliedPassword)
                        throws IdentityManagerException
Checks if the supplied password matches the one defined for a user with a given ID.

Parameters:
userID - the user ID
suppliedPassword - the supplied user password
Returns:
T if user if its identity is valid, F otherwise
Throws:
IdentityManagerException - if the group can't be added as member of the parent group

isReadOnly

boolean isReadOnly()
Get the ldap readOnly configuration value.

Returns:
true or false

isUserInGroup

boolean isUserInGroup(String userID,
                      String groupID)
                      throws IdentityManagerException
Checks if a given user belongs to a given group.

Parameters:
userID - the user ID
groupID - the group ID
Returns:
T if the user belongs to the group, F otherwise
Throws:
IdentityManagerException - if the operation can't be executed

isUserInGroup

boolean isUserInGroup(String userID,
                      String groupID,
                      boolean parseGroupHierarchy)
                      throws IdentityManagerException
Checks if a given user belongs to a given group.

Parameters:
userID - the user ID
groupID - the group ID
parseGroupHierarchy - contemplates the group Hierarchy
Returns:
T if the user belongs to the group, F otherwise
Throws:
IdentityManagerException - if the operation can't be executed

removeGroup

void removeGroup(String groupID)
                 throws IdentityManagerException
Removes an existing group from the manager, if it exists.

Parameters:
groupID - the id of the group to remove
Throws:
IdentityManagerException - if the group can't be removed

removeUser

void removeUser(String userID)
                throws IdentityManagerException
Removes an existing user from the manager, if it exists.

Parameters:
userID - the id of the user to remove
Throws:
IdentityManagerException - if the user can't be removed

removeUserFromGroup

void removeUserFromGroup(String userID,
                         String groupID)
                         throws IdentityManagerException
Removes an existing user from an existing group.

Parameters:
groupID - the group ID
userID - the user ID
Throws:
IdentityManagerException - if the user can't be removed from the group

removeUserParameter

void removeUserParameter(String userID,
                         String parameterID)
Removes a given parameter from a given user.

Parameters:
userID - the user ID
parameterID - the parameter ID

resetIdentityManager

void resetIdentityManager()
Resets the identity manager. Different implementations will offer distinct types of reset.


setUserParameter

void setUserParameter(String userID,
                      String parameterID,
                      Object parameterValue)
Sets an user parameter.

Parameters:
userID - the user ID
parameterID - the parameter ID
parameterValue - the parameter value

setUserParameters

void setUserParameters(String userID,
                       Map<String,Object> parametersMap)
Sets the user parameters as an whole.

Parameters:
userID - the user ID
parametersMap - the parameters map

updateGroup

void updateGroup(IDIFGroup existingGroup)
                 throws IdentityManagerException
Updates an existing group. Does nothing if the group doesn't exist.

Parameters:
existingGroup - the group to update
Throws:
IdentityManagerException - if the group can't be updated

updateUser

void updateUser(IDIFUser existingUser,
                String userID)
                throws IdentityManagerException
Updates an existing user. Does nothing if the user doesn't exist.

Parameters:
existingUser - the user to update
userID - the user ID (must be supplied separately to ensure data integrity if the user ID is changed)
Throws:
IdentityManagerException - if the operation can't be executed

updateUserAttribute

void updateUserAttribute(String userID,
                         String attributeID,
                         Object attributeValue)
                         throws IdentityManagerException
Updates an attribute value on a given user and persists it.

Parameters:
userID - the ID of the user to update
attributeID - the ID of the attribute to update
attributeValue - the value of the attribute to update
Throws:
IdentityManagerException - if the attribute can't be updated

updateUserAttributes

void updateUserAttributes(String userID,
                          Map<String,Object> attributes)
                          throws IdentityManagerException
Updates all of the user's attributes.

Parameters:
userID - the ID of the user to update
attributes - the attributes to update
Throws:
IdentityManagerException - if the attribute can't be updated

userExists

boolean userExists(String userID)
                   throws IdentityManagerException
Checks if a user exists on the manager.

Parameters:
userID - the ID of the user
Returns:
T if the user exists, F otherwise
Throws:
IdentityManagerException - if the operation can't be executed


Copyright © 2014 Digitalis Informática Lda. All Rights Reserved.