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)
           
 void addGroupToGroup(java.lang.String childGroup, java.lang.String parentGroup)
           
 LDAPUserWithAttributes addUser(UserTemplate user, PasswordCredential credential)
          Adds a user to LDAP.
 void addUserToGroup(java.lang.String username, java.lang.String groupName)
           
protected  java.lang.String encodePassword(java.lang.String unencodedPassword)
          Translates a clear-text password into an encrypted one, based on the directory settings.
 java.lang.String getDescriptiveName()
           
protected  void getNewUserDirectorySpecificAttributes(User user, javax.naming.directory.Attributes attributes)
          Populates attributes object with directory-specific attributes.
static java.lang.String getStaticDirectoryType()
           
 void removeGroup(java.lang.String name)
           
 void removeGroupFromGroup(java.lang.String childGroup, java.lang.String parentGroup)
           
 void removeUser(java.lang.String name)
           
 void removeUserFromGroup(java.lang.String username, java.lang.String groupName)
           
 Group renameGroup(java.lang.String oldName, java.lang.String newName)
           
 User renameUser(java.lang.String oldName, java.lang.String newName)
           
 Group updateGroup(GroupTemplate group)
           
 User updateUser(UserTemplate 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, getEncoder, 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 java.lang.String getStaticDirectoryType()

encodePassword

protected java.lang.String encodePassword(java.lang.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,
                                                     javax.naming.directory.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 java.lang.String getDescriptiveName()

addUserToGroup

public void addUserToGroup(java.lang.String username,
                           java.lang.String groupName)
                    throws UserNotFoundException,
                           GroupNotFoundException,
                           OperationFailedException
Throws:
UserNotFoundException
GroupNotFoundException
OperationFailedException

addGroupToGroup

public void addGroupToGroup(java.lang.String childGroup,
                            java.lang.String parentGroup)
                     throws GroupNotFoundException,
                            OperationFailedException
Throws:
GroupNotFoundException
OperationFailedException

removeUserFromGroup

public void removeUserFromGroup(java.lang.String username,
                                java.lang.String groupName)
                         throws UserNotFoundException,
                                GroupNotFoundException,
                                MembershipNotFoundException,
                                OperationFailedException
Throws:
UserNotFoundException
GroupNotFoundException
MembershipNotFoundException
OperationFailedException

removeGroupFromGroup

public void removeGroupFromGroup(java.lang.String childGroup,
                                 java.lang.String parentGroup)
                          throws GroupNotFoundException,
                                 MembershipNotFoundException,
                                 OperationFailedException
Throws:
GroupNotFoundException
MembershipNotFoundException
OperationFailedException

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
Specified by:
addGroup in interface RemoteDirectory
Overrides:
addGroup in class SpringLDAPConnector
Throws:
InvalidGroupException
OperationFailedException

renameGroup

public Group renameGroup(java.lang.String oldName,
                         java.lang.String newName)
                  throws GroupNotFoundException,
                         InvalidGroupException,
                         OperationFailedException
Specified by:
renameGroup in interface RemoteDirectory
Overrides:
renameGroup in class SpringLDAPConnector
Throws:
GroupNotFoundException
InvalidGroupException
OperationFailedException

renameUser

public User renameUser(java.lang.String oldName,
                       java.lang.String newName)
                throws UserNotFoundException,
                       InvalidUserException,
                       OperationFailedException
Specified by:
renameUser in interface RemoteDirectory
Overrides:
renameUser in class SpringLDAPConnector
Throws:
UserNotFoundException
InvalidUserException
OperationFailedException

updateGroup

public Group updateGroup(GroupTemplate group)
                  throws GroupNotFoundException,
                         OperationFailedException
Specified by:
updateGroup in interface RemoteDirectory
Overrides:
updateGroup in class SpringLDAPConnector
Throws:
GroupNotFoundException
OperationFailedException

updateUser

public User updateUser(UserTemplate user)
                throws UserNotFoundException,
                       OperationFailedException
Specified by:
updateUser in interface RemoteDirectory
Overrides:
updateUser in class SpringLDAPConnector
Throws:
UserNotFoundException
OperationFailedException

removeUser

public void removeUser(java.lang.String name)
                throws UserNotFoundException,
                       OperationFailedException
Specified by:
removeUser in interface RemoteDirectory
Overrides:
removeUser in class SpringLDAPConnector
Throws:
UserNotFoundException
OperationFailedException

removeGroup

public void removeGroup(java.lang.String name)
                 throws GroupNotFoundException,
                        OperationFailedException
Specified by:
removeGroup in interface RemoteDirectory
Overrides:
removeGroup in class SpringLDAPConnector
Throws:
GroupNotFoundException
OperationFailedException


Copyright © 2012 Atlassian. All Rights Reserved.