com.atlassian.crowd.integration.directory.connector
Class RFC4519Directory

java.lang.Object
  extended by com.atlassian.crowd.integration.directory.connector.SpringLDAPConnector
      extended by com.atlassian.crowd.integration.directory.connector.RFC4519Directory
All Implemented Interfaces:
LDAPDirectory, RemoteDirectory, AttributeAware, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
ApacheDS, MicrosoftActiveDirectory, NovelleDirectory, OpenLDAP, SunONE

public abstract class RFC4519Directory
extends SpringLDAPConnector

Read-write, nesting-aware implementation of RFC4519 user-group membership interactions.

A user is a member of a group if either: - the DN of user is present in the collection of member attribute values of the group - the user has a memberOf attribute which contains the DN of the group (must be enabled via LDAPPropertiesMapper)

See Also:
RFC2307GidNumberMapper, RFC2307MemberUidMapper

Field Summary
 
Fields inherited from class com.atlassian.crowd.integration.directory.connector.SpringLDAPConnector
applicationContext, attributes, contextSource, DEFAULT_PAGE_SIZE, eventManager, ldapPropertiesMapper, ldapQueryTranslater, ldapTemplate, logger, nameConverter, searchDN
 
Constructor Summary
RFC4519Directory()
           
 
Method Summary
 void addGroupToGroup(java.lang.String childGroup, java.lang.String parentGroup)
          Adds a group as a member of a parent group.
 void addUserToGroup(java.lang.String username, java.lang.String groupName)
          Adds a user as a member of a group.
protected  java.util.List<AttributeMapper> getCustomGroupAttributeMappers()
          As a minimum, this SHOULD provide an attribute mapper that maps the group members attribute (if available).
protected  java.util.List<AttributeMapper> getCustomUserAttributeMappers()
           
 boolean isGroupDirectGroupMember(java.lang.String childGroup, java.lang.String parentGroup)
          Determines if a group is a direct member of another group.
 boolean isUserDirectGroupMember(java.lang.String username, java.lang.String groupName)
          Determines if a user is a direct member of a group.
 void removeGroupFromGroup(java.lang.String childGroup, java.lang.String parentGroup)
          Removes a group as a member of a parent group.
 void removeUserFromGroup(java.lang.String username, java.lang.String groupName)
          Removes a user as a member of a group.
protected  java.util.List searchGroupRelationshipsWithGroupTypeSpecified(MembershipQuery query)
          Execute the search for group relationships given that a group of type GROUP or LEGACY_ROLE has been specified in the EntityDescriptor for the group(s).
 
Methods inherited from class com.atlassian.crowd.integration.directory.connector.SpringLDAPConnector
addDefaultSnToUserAttributes, addDefaultValueToUserAttributesForAttribute, addGroup, addUser, asLdapName, authenticate, encodePassword, findEntityByDN, findEntityByDN, findGroupByName, findGroupByNameAndType, findGroupWithAttributesByName, findUserByName, findUserWithAttributesByName, getAttribute, getAttributeAsBoolean, getAttributeAsLong, getAttributeNames, getAttributes, getBaseEnvironmentProperties, getContextSource, getDirectoryId, getEncoder, getGroupContextMapper, getInitialGroupMemberDN, getLdapPropertiesMapper, getNewGroupAttributes, getNewGroupDirectorySpecificAttributes, getNewUserAttributes, getNewUserDirectorySpecificAttributes, getSearchDN, getStandardisedDN, getSubTreeSearchControl, getUserContextMapper, hasAttribute, pageSearchResults, removeGroup, removeGroupAttributes, removeUser, removeUserAttributes, renameGroup, renameUser, searchEntities, searchEntitiesWithRequestControls, searchGroupObjects, searchGroupObjectsOfSpecifiedGroupType, searchGroupRelationships, searchGroups, searchUserObjects, searchUsers, setApplicationContext, setAttributes, setDirectoryId, setEventManager, setLdapQueryTranslater, storeGroupAttributes, storeUserAttributes, supportsNestedGroups, testConnection, updateGroup, updateUser, updateUserCredential
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.crowd.integration.directory.RemoteDirectory
getDescriptiveName
 

Constructor Detail

RFC4519Directory

public RFC4519Directory()
Method Detail

getCustomGroupAttributeMappers

protected java.util.List<AttributeMapper> getCustomGroupAttributeMappers()
Description copied from class: SpringLDAPConnector
As a minimum, this SHOULD provide an attribute mapper that maps the group members attribute (if available).

Overrides:
getCustomGroupAttributeMappers in class SpringLDAPConnector
Returns:
collection of custom attribute mappers (cannot be null but can be an empty list).

getCustomUserAttributeMappers

protected java.util.List<AttributeMapper> getCustomUserAttributeMappers()
Overrides:
getCustomUserAttributeMappers in class SpringLDAPConnector
Returns:
a collection of custom attribbute mappers. By default just return an empty list.

isUserDirectGroupMember

public boolean isUserDirectGroupMember(java.lang.String username,
                                       java.lang.String groupName)
Description copied from interface: RemoteDirectory
Determines if a user is a direct member of a group. The directory is NOT expected to resolve any transitive group relationships.

Parameters:
username - name of user.
groupName - name of group.
Returns:
true iff the user is a direct member of the group.

isGroupDirectGroupMember

public boolean isGroupDirectGroupMember(java.lang.String childGroup,
                                        java.lang.String parentGroup)
Description copied from interface: RemoteDirectory
Determines if a group is a direct member of another group. The directory is NOT expected to resolve any transitive group relationships.

Parameters:
childGroup - name of child group.
parentGroup - name of parent group.
Returns:
true iff the childGroup is a direct member of the parentGroup.

addUserToGroup

public void addUserToGroup(java.lang.String username,
                           java.lang.String groupName)
                    throws ObjectNotFoundException
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:
ObjectNotFoundException - If the user or group cannot be found.

addGroupToGroup

public void addGroupToGroup(java.lang.String childGroup,
                            java.lang.String parentGroup)
                     throws ObjectNotFoundException,
                            InvalidMembershipException
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:
ObjectNotFoundException - One or both of the groups cannot be found.
InvalidMembershipException - if the childGroup and parentGroup exist but are of different GroupTypes.

removeUserFromGroup

public void removeUserFromGroup(java.lang.String username,
                                java.lang.String groupName)
                         throws ObjectNotFoundException,
                                MembershipNotFoundException
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:
ObjectNotFoundException - If either the user or group cannot be found.
MembershipNotFoundException - if the user is not a direct member of the group.

removeGroupFromGroup

public void removeGroupFromGroup(java.lang.String childGroup,
                                 java.lang.String parentGroup)
                          throws ObjectNotFoundException,
                                 MembershipNotFoundException,
                                 InvalidMembershipException
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:
ObjectNotFoundException - One or both of the groups cannot be found.
MembershipNotFoundException - if the childGroup is not a direct member of the parentGroup.
InvalidMembershipException - if the childGroup and parentGroup exist but are of different GroupTypes.

searchGroupRelationshipsWithGroupTypeSpecified

protected java.util.List searchGroupRelationshipsWithGroupTypeSpecified(MembershipQuery query)
Description copied from class: SpringLDAPConnector
Execute the search for group relationships given that a group of type GROUP or LEGACY_ROLE has been specified in the EntityDescriptor for the group(s).

Specified by:
searchGroupRelationshipsWithGroupTypeSpecified in class SpringLDAPConnector
Parameters:
query - membership query with all GroupType's not null.
Returns:
list of members or memberships depending on the query.


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.