com.atlassian.crowd.directory
Class Rfc2307

java.lang.Object
  extended by com.atlassian.crowd.directory.SpringLDAPConnector
      extended by com.atlassian.crowd.directory.RFC2307Directory
          extended by com.atlassian.crowd.directory.Rfc2307
All Implemented Interfaces:
LDAPDirectory, RemoteDirectory, Attributes
Direct Known Subclasses:
AppleOpenDirectory, FedoraDS, OpenLDAPRfc2307

public class Rfc2307
extends RFC2307Directory

This class provides read-only support for the POSIX LDAP Schema (RFC2307)


Field Summary
 
Fields inherited from class com.atlassian.crowd.directory.SpringLDAPConnector
attributes, contextSource, contextSourceTransactionManager, DEFAULT_PAGE_SIZE, eventPublisher, ldapPropertiesMapper, ldapQueryTranslater, ldapTemplate, nameConverter, searchDN
 
Constructor Summary
Rfc2307(LDAPQueryTranslater ldapQueryTranslater, com.atlassian.event.api.EventPublisher eventPublisher, InstanceFactory instanceFactory, PasswordEncoderFactory passwordEncoderFactory)
           
 
Method Summary
 Group addGroup(GroupTemplate group)
          Adds a group to the directory store.
 void addGroupToGroup(String childGroup, String parentGroup)
          Adds a group as a member of a parent group.
 LDAPUserWithAttributes addUser(UserTemplate user, PasswordCredential credential)
          Adds a user to LDAP.
 void addUserToGroup(String username, String groupName)
          Adds a user as a member of a group.
protected  String encodePassword(String unencodedPassword)
          Translates a clear-text password into an encrypted one, based on the directory settings.
 String getDescriptiveName()
          Returns a descriptive name for the type of directory.
protected  void getNewUserDirectorySpecificAttributes(User user, Attributes attributes)
          Populates attributes object with directory-specific attributes.
static String getStaticDirectoryType()
           
 void removeGroup(String name)
          Removes the group that matches the supplied name.
 void removeGroupFromGroup(String childGroup, String parentGroup)
          Removes a group as a member of a parent group.
 void removeUser(String name)
          Removes the user that matches the supplied name.
 void removeUserFromGroup(String username, String groupName)
          Removes a user as a member of a group.
 Group renameGroup(String oldName, String newName)
          Renames a group.
 User renameUser(String oldName, String newName)
          Renames a user.
 Group updateGroup(GroupTemplate group)
          Updates the group.
 User updateUser(UserTemplate user)
          Updates the user.
 
Methods inherited from class com.atlassian.crowd.directory.RFC2307Directory
getCustomGroupAttributeMappers, getCustomUserAttributeMappers, isGroupDirectGroupMember, isUserDirectGroupMember, searchGroupRelationshipsWithGroupTypeSpecified, supportsNestedGroups
 
Methods inherited from class com.atlassian.crowd.directory.SpringLDAPConnector
addDefaultSnToUserAttributes, addDefaultValueToUserAttributesForAttribute, asLdapGroupName, asLdapName, asLdapUserName, authenticate, findEntityByDN, findEntityByDN, findGroupByName, findGroupByNameAndType, findGroupWithAttributesByName, findUserByName, findUserWithAttributesByName, getAttributeAsBoolean, getAttributeAsLong, getAuthoritativeDirectory, getBaseEnvironmentProperties, getContextSource, getDirectoryId, getGroupContextMapper, getInitialGroupMemberDN, getKeys, getLdapPropertiesMapper, getMemberships, getNewGroupAttributes, getNewGroupDirectorySpecificAttributes, getNewUserAttributes, getSearchDN, getStandardisedDN, getSubTreeSearchControl, getUserContextMapper, getValue, getValues, isEmpty, isRolesDisabled, pageSearchResults, postprocessGroups, removeGroupAttributes, removeUserAttributes, searchEntities, searchEntitiesWithRequestControls, searchGroupObjects, searchGroupObjectsOfSpecifiedGroupType, searchGroupRelationships, searchGroups, searchUserObjects, searchUsers, setAttributes, setDirectoryId, storeGroupAttributes, storeUserAttributes, supportsInactiveAccounts, testConnection, typedEntityNotFoundException, updateUserCredential
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rfc2307

public Rfc2307(LDAPQueryTranslater ldapQueryTranslater,
               com.atlassian.event.api.EventPublisher eventPublisher,
               InstanceFactory instanceFactory,
               PasswordEncoderFactory passwordEncoderFactory)
Method Detail

getStaticDirectoryType

public static String getStaticDirectoryType()

encodePassword

protected String encodePassword(String unencodedPassword)
Translates a clear-text password into an encrypted one, based on the directory settings.

Specified by:
encodePassword in class SpringLDAPConnector
Parameters:
unencodedPassword - password
Returns:
encoded password

getNewUserDirectorySpecificAttributes

protected void getNewUserDirectorySpecificAttributes(User user,
                                                     Attributes attributes)
Description copied from class: SpringLDAPConnector
Populates attributes object with directory-specific attributes.

Overrider of this method can take advantage of the default group attributes mapping logic in {#getNewUserAttributes(User)}.

Note that the attribute values supplied here will be used raw. This entails that overrider is responsible for supplying values in a format supported by the directory. In some directory implementations, for example, a blank string ("") is considered illegal. Overrider thus would have to make sure the method does not generate a value as such.

Overrides:
getNewUserDirectorySpecificAttributes in class SpringLDAPConnector
Parameters:
user - (potential) source of information that needs to be added.
attributes - attributes to add directory-specific information to.

getDescriptiveName

public String getDescriptiveName()
Description copied from interface: RemoteDirectory
Returns a descriptive name for the type of directory.

Returns:
descriptive name.

addUserToGroup

public void addUserToGroup(String username,
                           String groupName)
                    throws UserNotFoundException,
                           GroupNotFoundException,
                           OperationFailedException
Description copied from interface: RemoteDirectory
Adds a user as a member of a group. This means that all user members of childGroup will appear as members of parentGroup to querying applications.

Parameters:
username - The user that will become a member of groupName
groupName - The group that will gain a new member.
Throws:
UserNotFoundException - If the user cannot be found.
GroupNotFoundException - If the group cannot be found.
OperationFailedException - underlying directory implementation failed to execute the operation.

addGroupToGroup

public void addGroupToGroup(String childGroup,
                            String parentGroup)
                     throws GroupNotFoundException,
                            OperationFailedException
Description copied from interface: RemoteDirectory
Adds a group as a member of a parent group.

Parameters:
childGroup - The group that will become a member of parentGroup
parentGroup - The group that will gain a new member
Throws:
GroupNotFoundException - One or both of the groups cannot be found.
OperationFailedException - underlying directory implementation failed to execute the operation.

removeUserFromGroup

public void removeUserFromGroup(String username,
                                String groupName)
                         throws UserNotFoundException,
                                GroupNotFoundException,
                                MembershipNotFoundException,
                                OperationFailedException
Description copied from interface: RemoteDirectory
Removes a user as a member of a group.

Parameters:
username - The user that will be removed from parentGroup
groupName - The group that will lose the member.
Throws:
UserNotFoundException - If the user cannot be found.
GroupNotFoundException - If the group cannot be found.
MembershipNotFoundException - if the user is not a direct member of the group.
OperationFailedException - underlying directory implementation failed to execute the operation.

removeGroupFromGroup

public void removeGroupFromGroup(String childGroup,
                                 String parentGroup)
                          throws GroupNotFoundException,
                                 MembershipNotFoundException,
                                 OperationFailedException
Description copied from interface: RemoteDirectory
Removes a group as a member of a parent group.

Parameters:
childGroup - The group that will be removed from parentGroup
parentGroup - The group that will lose the member.
Throws:
GroupNotFoundException - One or both of the groups cannot be found.
MembershipNotFoundException - if the childGroup is not a direct member of the parentGroup.
OperationFailedException - underlying directory implementation failed to execute the operation.

addUser

public LDAPUserWithAttributes addUser(UserTemplate user,
                                      PasswordCredential credential)
                               throws InvalidUserException,
                                      InvalidCredentialException,
                                      OperationFailedException
Description copied from class: SpringLDAPConnector
Adds a user to LDAP.

If the displayName on the user is blank, then the

Specified by:
addUser in interface RemoteDirectory
Overrides:
addUser in class SpringLDAPConnector
Parameters:
user - template of the user to add.
credential - password.
Returns:
LDAP user retrieved from LDAP after successfully adding the user to LDAP.
Throws:
InvalidUserException - if the user to create was deemed invalid by the LDAP server or already exists.
InvalidCredentialException - if the password credential was deemed invalid by the password encoder.
OperationFailedException - if we were unable to add the user to LDAP.

addGroup

public Group addGroup(GroupTemplate group)
               throws InvalidGroupException,
                      OperationFailedException
Description copied from interface: RemoteDirectory
Adds a group to the directory store.

Specified by:
addGroup in interface RemoteDirectory
Overrides:
addGroup in class SpringLDAPConnector
Parameters:
group - template of the group to add.
Returns:
the added group retrieved from the underlying store.
Throws:
InvalidGroupException - The supplied group is invalid.
OperationFailedException - underlying directory implementation failed to execute the operation.

renameGroup

public Group renameGroup(String oldName,
                         String newName)
                  throws GroupNotFoundException,
                         InvalidGroupException,
                         OperationFailedException
Description copied from interface: RemoteDirectory
Renames a group.

Specified by:
renameGroup in interface RemoteDirectory
Overrides:
renameGroup in class SpringLDAPConnector
Parameters:
oldName - name of existing group.
newName - desired name of group.
Returns:
renamed group.
Throws:
GroupNotFoundException - if the group with the existing name does not exist.
InvalidGroupException - if the new groupname is invalid or already exists in the directory.
OperationFailedException - if the underlying directory implementation failed to execute the operation.

renameUser

public User renameUser(String oldName,
                       String newName)
                throws UserNotFoundException,
                       InvalidUserException,
                       OperationFailedException
Description copied from interface: RemoteDirectory
Renames a user.

Specified by:
renameUser in interface RemoteDirectory
Overrides:
renameUser in class SpringLDAPConnector
Parameters:
oldName - name of existing user.
newName - desired name of user.
Returns:
renamed user.
Throws:
UserNotFoundException - if the user with the existing name does not exist.
InvalidUserException - if the new username is invalid.
OperationFailedException - if the underlying directory implementation failed to execute the operation.

updateGroup

public Group updateGroup(GroupTemplate group)
                  throws GroupNotFoundException,
                         OperationFailedException
Description copied from interface: RemoteDirectory
Updates the group.

Specified by:
updateGroup in interface RemoteDirectory
Overrides:
updateGroup in class SpringLDAPConnector
Parameters:
group - The group to update.
Returns:
the updated group retrieved from the underlying store.
Throws:
GroupNotFoundException - the group does not exist in the directory store.
OperationFailedException - underlying directory implementation failed to execute the operation.

updateUser

public User updateUser(UserTemplate user)
                throws UserNotFoundException,
                       OperationFailedException
Description copied from interface: RemoteDirectory
Updates the user.

Specified by:
updateUser in interface RemoteDirectory
Overrides:
updateUser in class SpringLDAPConnector
Parameters:
user - The user to update.
Returns:
the updated user retrieved from the underlying store.
Throws:
UserNotFoundException - the user does not exist in the directory store.
OperationFailedException - underlying directory implementation failed to execute the operation.

removeUser

public void removeUser(String name)
                throws UserNotFoundException,
                       OperationFailedException
Description copied from interface: RemoteDirectory
Removes the user that matches the supplied name.

Specified by:
removeUser in interface RemoteDirectory
Overrides:
removeUser in class SpringLDAPConnector
Parameters:
name - The name of the user (username).
Throws:
UserNotFoundException - The user does not exist.
OperationFailedException - underlying directory implementation failed to execute the operation.

removeGroup

public void removeGroup(String name)
                 throws GroupNotFoundException,
                        OperationFailedException
Description copied from interface: RemoteDirectory
Removes the group that matches the supplied name.

Specified by:
removeGroup in interface RemoteDirectory
Overrides:
removeGroup in class SpringLDAPConnector
Parameters:
name - The name of the group.
Throws:
GroupNotFoundException - The group does not exist.
OperationFailedException - underlying directory implementation failed to execute the operation.


Copyright © 2012 Atlassian. All Rights Reserved.