|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.crowd.directory.SpringLDAPConnector
public abstract class SpringLDAPConnector
This class implements a remote LDAP directory using Spring LdapTemplate.
Warning: CWD-2494: When read timeout is enabled, operations can fail randomly with "javax.naming.NamingException: LDAP response read timed out..." error message without waiting for the timeout to pass.
Field Summary | |
---|---|
protected AttributeValuesHolder |
attributes
|
protected org.springframework.ldap.core.ContextSource |
contextSource
|
protected org.springframework.ldap.transaction.compensating.manager.ContextSourceTransactionManager |
contextSourceTransactionManager
|
static int |
DEFAULT_PAGE_SIZE
|
protected com.atlassian.event.api.EventPublisher |
eventPublisher
|
protected LDAPPropertiesMapper |
ldapPropertiesMapper
|
protected LDAPQueryTranslater |
ldapQueryTranslater
|
protected LdapTemplateWithClassLoaderWrapper |
ldapTemplate
|
protected Converter |
nameConverter
|
protected SearchDN |
searchDN
|
Constructor Summary | |
---|---|
SpringLDAPConnector(LDAPQueryTranslater ldapQueryTranslater,
com.atlassian.event.api.EventPublisher eventPublisher,
InstanceFactory instanceFactory)
|
Method Summary | ||
---|---|---|
protected void |
addDefaultSnToUserAttributes(Attributes attrs,
String defaultSnValue)
A default install of many directory servers (inc. |
|
protected void |
addDefaultValueToUserAttributesForAttribute(String attributeName,
Attributes attrs,
String defaultValue)
|
|
Group |
addGroup(GroupTemplate group)
Adds a group to the directory store. |
|
LDAPUserWithAttributes |
addUser(UserTemplate user,
PasswordCredential credential)
Adds a user to LDAP. |
|
protected LdapName |
asLdapGroupName(String dn,
String groupName)
Convenience method to convert group DN to LdapName, throwing a GNFE with the supplied group name if unable to construct the LdapName. |
|
protected
|
asLdapName(String dn,
String entityName,
Class<T> entityClass)
This method is required to wrap DN's into LdapNames as spring-ldap doesn't correctly handle operations with String dn arguments. |
|
protected LdapName |
asLdapUserName(String dn,
String userName)
Convenience method to convert user DN to LdapName, throwing a GNFE with the supplied user name if unable to construct the LdapName. |
|
User |
authenticate(String name,
PasswordCredential credential)
Authenticates a user with the directory store. |
|
protected abstract Object |
encodePassword(String unencodedPassword)
Given an plain-text password, encodes/encrypts it according to the settings required by the particular directory connector. |
|
|
findEntityByDN(String dn,
Class<T> entityClass)
Finds a directory entity (principal, group or role) by their distinguished name. |
|
protected
|
findEntityByDN(String dn,
String baseDN,
String filter,
org.springframework.ldap.core.ContextMapper contextMapper,
Class<T> entityClass)
|
|
LDAPGroupWithAttributes |
findGroupByName(String name)
Finds the group that matches the supplied name . |
|
protected LDAPGroupWithAttributes |
findGroupByNameAndType(String name,
GroupType groupType)
|
|
LDAPGroupWithAttributes |
findGroupWithAttributesByName(String name)
Finds the group that matches the supplied name . |
|
LDAPUserWithAttributes |
findUserByName(String name)
Finds the user that matches the supplied name . |
|
LDAPUserWithAttributes |
findUserWithAttributesByName(String name)
Finds the user that matches the supplied name . |
|
boolean |
getAttributeAsBoolean(String name,
boolean defaultValue)
|
|
long |
getAttributeAsLong(String name,
long defaultValue)
|
|
RemoteDirectory |
getAuthoritativeDirectory()
|
|
protected Map<String,String> |
getBaseEnvironmentProperties()
Returns the properties used to set up the Ldap ContextSource. |
|
org.springframework.ldap.core.ContextSource |
getContextSource()
Exposed so that delegated directories can get a handle on the underlying LDAP context. |
|
protected List<AttributeMapper> |
getCustomGroupAttributeMappers()
As a minimum, this SHOULD provide an attribute mapper that maps the group members attribute (if available). |
|
protected List<AttributeMapper> |
getCustomUserAttributeMappers()
|
|
long |
getDirectoryId()
Gets the internal unique directoryId of the directory store. |
|
ContextMapperWithRequiredAttributes<LDAPGroupWithAttributes> |
getGroupContextMapper(GroupType groupType)
Returns a ContextMapper ready to translate LDAP objects into Groups and fetches all member objects. |
|
protected String |
getInitialGroupMemberDN()
Returns the default container member DN. |
|
Set<String> |
getKeys()
Gets all the keys of the attributes. |
|
LDAPPropertiesMapper |
getLdapPropertiesMapper()
|
|
protected Attributes |
getNewGroupAttributes(Group group)
|
|
protected void |
getNewGroupDirectorySpecificAttributes(Group group,
Attributes attributes)
Populates attributes object with directory-specific attributes. |
|
protected Attributes |
getNewUserAttributes(User user,
PasswordCredential credential)
Translates the User into LDAP attributes, in preparation for creating a new user. |
|
protected void |
getNewUserDirectorySpecificAttributes(User user,
Attributes attributes)
Populates attributes object with directory-specific attributes. |
|
SearchDN |
getSearchDN()
|
|
protected String |
getStandardisedDN(LdapName dn)
|
|
protected SearchControls |
getSubTreeSearchControls(ContextMapperWithRequiredAttributes<?> mapper)
|
|
ContextMapperWithRequiredAttributes<LDAPUserWithAttributes> |
getUserContextMapper()
Returns a ContextMapper that can transform a Context into a User. |
|
String |
getValue(String name)
Returns any value associated with the given key, returns null if there is no value. |
|
Set<String> |
getValues(String name)
Get all the values associated with a given key. |
|
boolean |
isEmpty()
|
|
boolean |
isRolesDisabled()
Expose whether the directory has roles disabled. |
|
protected org.springframework.ldap.core.CollectingNameClassPairCallbackHandler |
pageSearchResults(Name baseDN,
String filter,
org.springframework.ldap.core.ContextMapper contextMapper,
SearchControls searchControls,
org.springframework.ldap.core.DirContextProcessor ldapRequestControls,
int maxResults)
Performs a paged results search on an LDAP directory server searching using the LDAP paged results control option to fetch results in chunks rather than all at once. |
|
protected List<LDAPGroupWithAttributes> |
postprocessGroups(List<LDAPGroupWithAttributes> groups)
Perform any post-processing on groups. |
|
void |
removeGroup(String name)
Removes the group that matches the supplied name . |
|
void |
removeGroupAttributes(String groupName,
String attributeName)
Removes all the values for a single attribute key for a group. |
|
void |
removeUser(String name)
Removes the user that matches the supplied name . |
|
void |
removeUserAttributes(String username,
String attributeName)
Removes all the values for a single attribute key for a user. |
|
Group |
renameGroup(String oldName,
String newName)
Renames a group . |
|
User |
renameUser(String oldName,
String newName)
Renames a user . |
|
protected
|
searchEntities(Name baseDN,
String filter,
ContextMapperWithRequiredAttributes<T> contextMapper,
int startIndex,
int maxResults)
Executes a search with paging if paged results is supported. |
|
protected
|
searchEntitiesWithRequestControls(Name baseDN,
String filter,
ContextMapperWithRequiredAttributes<T> contextMapper,
SearchControls searchControls,
org.springframework.ldap.core.DirContextProcessor ldapRequestControls,
int startIndex,
int maxResults)
|
|
protected
|
searchGroupObjects(EntityQuery<?> query,
ContextMapperWithRequiredAttributes<T> mapper)
|
|
protected
|
searchGroupObjectsOfSpecifiedGroupType(EntityQuery<?> query,
ContextMapperWithRequiredAttributes<T> mapper)
This method expects that the query contains a non-null groupType in the entityDescriptor. |
|
|
searchGroupRelationships(MembershipQuery<T> query)
Searches for membership information. |
|
protected abstract
|
searchGroupRelationshipsWithGroupTypeSpecified(MembershipQuery<T> 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). |
|
|
searchGroups(EntityQuery<T> query)
Searches for groups that match the supplied query criteria. |
|
protected List<LDAPUserWithAttributes> |
searchUserObjects(EntityQuery<?> query)
|
|
|
searchUsers(EntityQuery<T> query)
Searches for users that match the supplied query criteria. |
|
void |
setAttributes(Map<String,String> attributes)
Called by the DirectoryInstanceLoader after
constructing an InternalDirectory. |
|
void |
setDirectoryId(long id)
Called by the DirectoryInstanceLoader after
constructing an InternalDirectory. |
|
void |
storeGroupAttributes(String groupName,
Map<String,Set<String>> attributes)
Adds or updates a group's attributes with the new Map of attribute values in the directory specified by the passed in directoryId . |
|
void |
storeUserAttributes(String username,
Map<String,Set<String>> attributes)
Adds or updates a user's attributes with the new Map of attribute values in the directory specified by the passed in directoryId . |
|
boolean |
supportsInactiveAccounts()
Storing active/inactive flag for users in LDAP is currently not supported. |
|
boolean |
supportsNestedGroups()
Allows us to only display nested-group related UI for directories that support it. |
|
void |
testConnection()
Test if a connection to the directory server can be established. |
|
protected
|
typedEntityNotFoundException(String name,
Class<T> entityClass)
|
|
Group |
updateGroup(GroupTemplate group)
Updates the group . |
|
User |
updateUser(UserTemplate user)
Updates the user . |
|
void |
updateUserCredential(String name,
PasswordCredential credential)
Updates the password for a user . |
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.directory.RemoteDirectory |
---|
addGroupToGroup, addUserToGroup, getDescriptiveName, getMemberships, isGroupDirectGroupMember, isUserDirectGroupMember, removeGroupFromGroup, removeUserFromGroup |
Field Detail |
---|
public static final int DEFAULT_PAGE_SIZE
protected volatile AttributeValuesHolder attributes
protected volatile LdapTemplateWithClassLoaderWrapper ldapTemplate
protected volatile org.springframework.ldap.core.ContextSource contextSource
protected volatile Converter nameConverter
protected volatile SearchDN searchDN
protected volatile LDAPPropertiesMapper ldapPropertiesMapper
protected volatile org.springframework.ldap.transaction.compensating.manager.ContextSourceTransactionManager contextSourceTransactionManager
protected final LDAPQueryTranslater ldapQueryTranslater
protected final com.atlassian.event.api.EventPublisher eventPublisher
Constructor Detail |
---|
public SpringLDAPConnector(LDAPQueryTranslater ldapQueryTranslater, com.atlassian.event.api.EventPublisher eventPublisher, InstanceFactory instanceFactory)
Method Detail |
---|
public long getDirectoryId()
RemoteDirectory
directoryId
of the directory store.
getDirectoryId
in interface RemoteDirectory
directoryId
.public void setDirectoryId(long id)
DirectoryInstanceLoader
after
constructing an InternalDirectory.
setDirectoryId
in interface RemoteDirectory
id
- The unique id
of the Directory stored in the database.public void setAttributes(Map<String,String> attributes)
DirectoryInstanceLoader
after
constructing an InternalDirectory.
setAttributes
in interface RemoteDirectory
attributes
- attributes map.public org.springframework.ldap.core.ContextSource getContextSource()
public LDAPPropertiesMapper getLdapPropertiesMapper()
public Set<String> getValues(String name)
Attributes
getValues
in interface Attributes
name
- the key to retrieve the values for
public String getValue(String name)
Attributes
null
if there is no value.
getValue
in interface Attributes
name
- the key to retrieve the value for
null
if there is no valuepublic boolean isEmpty()
isEmpty
in interface Attributes
true
if there are no attributespublic long getAttributeAsLong(String name, long defaultValue)
public boolean getAttributeAsBoolean(String name, boolean defaultValue)
public Set<String> getKeys()
Attributes
getKeys
in interface Attributes
public SearchDN getSearchDN()
protected SearchControls getSubTreeSearchControls(ContextMapperWithRequiredAttributes<?> mapper)
protected Map<String,String> getBaseEnvironmentProperties()
protected org.springframework.ldap.core.CollectingNameClassPairCallbackHandler pageSearchResults(Name baseDN, String filter, org.springframework.ldap.core.ContextMapper contextMapper, SearchControls searchControls, org.springframework.ldap.core.DirContextProcessor ldapRequestControls, int maxResults) throws OperationFailedException
baseDN
- The DN to beging the search from.filter
- The search filter.contextMapper
- Maps from LDAP search results into objects such as Group
s.searchControls
- The LDAP search scope type.ldapRequestControls
- Any LDAP request controls (set to null
if you do not need additional request controls for the search).maxResults
- maximum number of results to return. Set to -1
if no result limiting is desired (WARNING: doing so is obviously a hazard).
OperationFailedException
- Search failed due to a communication error to the remote directoryprotected <T> List<T> searchEntities(Name baseDN, String filter, ContextMapperWithRequiredAttributes<T> contextMapper, int startIndex, int maxResults) throws OperationFailedException
baseDN
- base DN of search.filter
- encoded LDAP search filter.contextMapper
- directory context to object mapper.startIndex
- index to start at. Set to 0
to start from the first result.maxResults
- maximum number of results to return. Set to -1
if no result limiting is desired (WARNING: doing so is obviously a hazard).
OperationFailedException
- a Communication error occurred when trying to talk to a remote directoryprotected <T> List<T> searchEntitiesWithRequestControls(Name baseDN, String filter, ContextMapperWithRequiredAttributes<T> contextMapper, SearchControls searchControls, org.springframework.ldap.core.DirContextProcessor ldapRequestControls, int startIndex, int maxResults) throws OperationFailedException
OperationFailedException
public ContextMapperWithRequiredAttributes<LDAPUserWithAttributes> getUserContextMapper()
protected List<AttributeMapper> getCustomUserAttributeMappers()
public ContextMapperWithRequiredAttributes<LDAPGroupWithAttributes> getGroupContextMapper(GroupType groupType)
groupType
- the GroupType
protected List<AttributeMapper> getCustomGroupAttributeMappers()
public LDAPUserWithAttributes findUserByName(String name) throws UserNotFoundException, OperationFailedException
RemoteDirectory
user
that matches the supplied name
.
findUserByName
in interface RemoteDirectory
name
- the name of the user (username).
UserNotFoundException
- a user with the supplied name does not exist.
OperationFailedException
- underlying directory implementation failed to execute the operation.public LDAPUserWithAttributes findUserWithAttributesByName(String name) throws UserNotFoundException, OperationFailedException
RemoteDirectory
user
that matches the supplied name
.
findUserWithAttributesByName
in interface RemoteDirectory
name
- the name of the user (username).
UserNotFoundException
- a user with the supplied name does not exist.
OperationFailedException
- underlying directory implementation failed to execute the operation.protected List<LDAPUserWithAttributes> searchUserObjects(EntityQuery<?> query) throws OperationFailedException, IllegalArgumentException
OperationFailedException
IllegalArgumentException
public void removeUser(String name) throws UserNotFoundException, OperationFailedException
RemoteDirectory
user
that matches the supplied name
.
removeUser
in interface RemoteDirectory
name
- The name of the user (username).
UserNotFoundException
- The user does not exist.
OperationFailedException
- underlying directory implementation failed to execute the operation.public void updateUserCredential(String name, PasswordCredential credential) throws InvalidCredentialException, UserNotFoundException, OperationFailedException
RemoteDirectory
password
for a user
.
updateUserCredential
in interface RemoteDirectory
name
- The name of the user (username).credential
- The new credential (password).
InvalidCredentialException
- The supplied credential is invalid.
UserNotFoundException
- The user does not exist.
OperationFailedException
- underlying directory implementation failed to execute the operation.public User renameUser(String oldName, String newName) throws UserNotFoundException, InvalidUserException, OperationFailedException
RemoteDirectory
user
.
renameUser
in interface RemoteDirectory
oldName
- name of existing user.newName
- desired name of user.
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.public void storeUserAttributes(String username, Map<String,Set<String>> attributes) throws UserNotFoundException, OperationFailedException
RemoteDirectory
directoryId
.
The attributes map represents new or updated attributes and does not replace existing attributes unless the key of an attribute
matches the key of an existing
Attributes with values of empty sets are not added (these attributes are effectively removed).
storeUserAttributes
in interface RemoteDirectory
username
- name of user to update.attributes
- new or updated attributes (attributes that don't need changing should not appear in this Map).
UserNotFoundException
- user with supplied username does not exist.
OperationFailedException
- underlying directory implementation failed to execute the operation.public void removeUserAttributes(String username, String attributeName) throws UserNotFoundException, OperationFailedException
RemoteDirectory
removeUserAttributes
in interface RemoteDirectory
username
- name of the user to update.attributeName
- name of attribute to remove.
UserNotFoundException
- user with supplied username does not exist.
OperationFailedException
- underlying directory implementation failed to execute the operation.protected Attributes getNewUserAttributes(User user, PasswordCredential credential) throws InvalidCredentialException, org.springframework.ldap.NamingException
User
into LDAP attributes, in preparation for creating a new user.
user
- The user object to translate into LDAP attributescredential
- raw password.
InvalidCredentialException
- The password, if supplied, was invalid in some manner.
org.springframework.ldap.NamingException
- If the User
could not be translated to an Attributes
protected void getNewUserDirectorySpecificAttributes(User user, Attributes attributes)
user
- (potential) source of information that needs to be added.attributes
- attributes to add directory-specific information to.public LDAPUserWithAttributes addUser(UserTemplate user, PasswordCredential credential) throws InvalidUserException, InvalidCredentialException, OperationFailedException
addUser
in interface RemoteDirectory
user
- template of the user to add.credential
- password.
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.protected void addDefaultSnToUserAttributes(Attributes attrs, String defaultSnValue)
sn
if it's not present in the
information provided.
attrs
- The LDAP user attributes to be checked and potentially updated.defaultSnValue
- default lastname/surname valueprotected void addDefaultValueToUserAttributesForAttribute(String attributeName, Attributes attrs, String defaultValue)
public <T extends LDAPDirectoryEntity> T findEntityByDN(String dn, Class<T> entityClass) throws UserNotFoundException, GroupNotFoundException, OperationFailedException
LDAPDirectory
findEntityByDN
in interface LDAPDirectory
dn
- standardised distinguished name.entityClass
- class of the entity to find (either LDAPUserWithAttributes
or LDAPGroupWithAttributes
).
UserNotFoundException
- if a user
does not exist at the specified DN or the DN does not
exist in the directory. This will also be thrown if
the entity DOES exist but does not match the base DN
or object filter for the entity type.
GroupNotFoundException
- if a user
does not exist at the specified DN or the DN does not
exist in the directory. This will also be thrown if
the entity DOES exist but does not match the base DN
or object filter for the entity type.
OperationFailedException
- if underlying directory implementation failed to execute the operation.protected <T extends LDAPDirectoryEntity> RuntimeException typedEntityNotFoundException(String name, Class<T> entityClass) throws UserNotFoundException, GroupNotFoundException
UserNotFoundException
GroupNotFoundException
protected <T extends LDAPDirectoryEntity> T findEntityByDN(String dn, String baseDN, String filter, org.springframework.ldap.core.ContextMapper contextMapper, Class<T> entityClass) throws UserNotFoundException, GroupNotFoundException, OperationFailedException
UserNotFoundException
GroupNotFoundException
OperationFailedException
public User updateUser(UserTemplate user) throws UserNotFoundException, OperationFailedException
RemoteDirectory
user
.
updateUser
in interface RemoteDirectory
user
- The user to update.
UserNotFoundException
- the user does not exist in the directory store.
OperationFailedException
- underlying directory implementation failed to execute the operation.public <T> List<T> searchUsers(EntityQuery<T> query) throws OperationFailedException
RemoteDirectory
users
that match the supplied query criteria.
searchUsers
in interface RemoteDirectory
query
- EntityQuery for Entity.USER.
List<User
>
or List<String
>
of users/usernames
matching the search criteria. An empty List
will be returned
if no users matching the criteria are found.
OperationFailedException
- if the underlying directory implementation failed to execute the operationpublic User authenticate(String name, PasswordCredential credential) throws InvalidAuthenticationException, UserNotFoundException, OperationFailedException
RemoteDirectory
user
with the directory store.
authenticate
in interface RemoteDirectory
name
- The name of the user (username).credential
- The supplied credentials (password).
InvalidAuthenticationException
- Authentication with the provided credentials failed.
UserNotFoundException
- The user wth the supplied name does not exist.
OperationFailedException
- underlying directory implementation failed to execute the operation.public LDAPGroupWithAttributes findGroupByName(String name) throws GroupNotFoundException, OperationFailedException
RemoteDirectory
group
that matches the supplied name
.
findGroupByName
in interface RemoteDirectory
name
- the name of the group.
GroupNotFoundException
- a group with the supplied name does not exist.
OperationFailedException
- underlying directory implementation failed to execute the operation.public LDAPGroupWithAttributes findGroupWithAttributesByName(String name) throws GroupNotFoundException, OperationFailedException
RemoteDirectory
group
that matches the supplied name
.
findGroupWithAttributesByName
in interface RemoteDirectory
name
- the name of the group.
GroupNotFoundException
- a group with the supplied name does not exist.
OperationFailedException
- underlying directory implementation failed to execute the operation.protected LDAPGroupWithAttributes findGroupByNameAndType(String name, GroupType groupType) throws GroupNotFoundException, OperationFailedException
GroupNotFoundException
OperationFailedException
protected <T> List<T> searchGroupObjectsOfSpecifiedGroupType(EntityQuery<?> query, ContextMapperWithRequiredAttributes<T> mapper) throws OperationFailedException
query
- search query.mapper
-
OperationFailedException
- represents a Communication error when trying to talk to a remote directoryprotected <T> Iterable<T> searchGroupObjects(EntityQuery<?> query, ContextMapperWithRequiredAttributes<T> mapper) throws OperationFailedException
OperationFailedException
public <T> List<T> searchGroups(EntityQuery<T> query) throws OperationFailedException
RemoteDirectory
groups
that match the supplied query criteria.
searchGroups
in interface RemoteDirectory
query
- EntityQuery for Entity.GROUP.
List
or List
of groups/groupnames
matching the search criteria. An empty List
will be returned
if no groups matching the criteria are found.
OperationFailedException
- if the underlying directory implementation failed to execute the operationprotected List<LDAPGroupWithAttributes> postprocessGroups(List<LDAPGroupWithAttributes> groups) throws OperationFailedException
groups
- to post-process
OperationFailedException
- if processing encounters a problem with the underlying directoryprotected Attributes getNewGroupAttributes(Group group) throws org.springframework.ldap.NamingException
org.springframework.ldap.NamingException
protected void getNewGroupDirectorySpecificAttributes(Group group, Attributes attributes)
group
- (potential) source of information that needs to be added.attributes
- attributes to add directory-specific information to.protected String getInitialGroupMemberDN()
public Group addGroup(GroupTemplate group) throws InvalidGroupException, OperationFailedException
RemoteDirectory
group
to the directory store.
addGroup
in interface RemoteDirectory
group
- template of the group to add.
InvalidGroupException
- The supplied group is invalid.
OperationFailedException
- underlying directory implementation failed to execute the operation.public Group updateGroup(GroupTemplate group) throws GroupNotFoundException, OperationFailedException
RemoteDirectory
group
.
updateGroup
in interface RemoteDirectory
group
- The group to update.
GroupNotFoundException
- the group does not exist in the directory store.
OperationFailedException
- underlying directory implementation failed to execute the operation.public void removeGroup(String name) throws GroupNotFoundException, OperationFailedException
RemoteDirectory
group
that matches the supplied name
.
removeGroup
in interface RemoteDirectory
name
- The name of the group.
GroupNotFoundException
- The group does not exist.
OperationFailedException
- underlying directory implementation failed to execute the operation.public Group renameGroup(String oldName, String newName) throws GroupNotFoundException, InvalidGroupException, OperationFailedException
RemoteDirectory
group
.
renameGroup
in interface RemoteDirectory
oldName
- name of existing group.newName
- desired name of group.
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.public void storeGroupAttributes(String groupName, Map<String,Set<String>> attributes) throws GroupNotFoundException, OperationFailedException
RemoteDirectory
directoryId
.
The attributes map represents new or updated attributes and does not replace existing attributes unless the key of an attribute
matches the key of an existing
Attributes with values of empty sets are not added (these attributes are effectively removed).
storeGroupAttributes
in interface RemoteDirectory
groupName
- name of group to update.attributes
- new or updated attributes (attributes that don't need changing should not appear in this Map).
GroupNotFoundException
- group with supplied groupName does not exist.
OperationFailedException
- underlying directory implementation failed to execute the operation.public void removeGroupAttributes(String groupName, String attributeName) throws GroupNotFoundException, OperationFailedException
RemoteDirectory
removeGroupAttributes
in interface RemoteDirectory
groupName
- name of the group to update.attributeName
- name of attribute to remove.
GroupNotFoundException
- group with supplied groupName does not exist.
OperationFailedException
- underlying directory implementation failed to execute the operation.public <T> List<T> searchGroupRelationships(MembershipQuery<T> query) throws OperationFailedException
RemoteDirectory
searchGroupRelationships
in interface RemoteDirectory
query
- query for memberships.
OperationFailedException
- underlying directory implementation failed to execute the operation.protected abstract <T> Iterable<T> searchGroupRelationshipsWithGroupTypeSpecified(MembershipQuery<T> query) throws OperationFailedException
query
- membership query with all GroupType's not null.
OperationFailedException
- if the operation failed due to a communication error with the remote directory,
or if the query is invalidprotected abstract Object encodePassword(String unencodedPassword) throws InvalidCredentialException
unencodedPassword
- The password to be transformed
InvalidCredentialException
- If the password could not be converted.public boolean supportsNestedGroups()
RemoteDirectory
supportsNestedGroups
in interface RemoteDirectory
public boolean isRolesDisabled()
RemoteDirectory
isRolesDisabled
in interface RemoteDirectory
public void testConnection() throws OperationFailedException
RemoteDirectory
testConnection
in interface RemoteDirectory
OperationFailedException
- underlying directory implementation failed to execute the operation.protected String getStandardisedDN(LdapName dn) throws OperationFailedException
OperationFailedException
protected <T extends LDAPDirectoryEntity> LdapName asLdapName(String dn, String entityName, Class<T> entityClass) throws UserNotFoundException, GroupNotFoundException
dn
- string version of DN.entityName
- used if NotFoundException needs to be thrown.entityClass
- in case there is a problem converting the dn into an LdapName a NotFoundException of this type (group/user) will be thrown.
Must implement User or Group, otherwise an IllegalArgumentException will be thrown.
UserNotFoundException
- unable to construct LdapName for User.
GroupNotFoundException
- unable to construct LdapName for Group.protected LdapName asLdapGroupName(String dn, String groupName) throws GroupNotFoundException
dn
- DN of the Group.groupName
- for GNFE exception.
GroupNotFoundException
- unable to construct LdapName.protected LdapName asLdapUserName(String dn, String userName) throws UserNotFoundException
dn
- DN of the User.userName
- for GNFE exception.
UserNotFoundException
- unable to construct LdapName.public boolean supportsInactiveAccounts()
supportsInactiveAccounts
in interface RemoteDirectory
public RemoteDirectory getAuthoritativeDirectory()
getAuthoritativeDirectory
in interface RemoteDirectory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |