public class AmbariLdapDataPopulator extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
AmbariLdapDataPopulator.LdapGroupContextMapper |
protected static class |
AmbariLdapDataPopulator.LdapUserContextMapper |
Modifier and Type | Field and Description |
---|---|
protected LdapServerProperties |
ldapServerProperties
LDAP specific properties.
|
Constructor and Description |
---|
AmbariLdapDataPopulator(com.google.inject.Provider<AmbariLdapConfiguration> configurationProvider,
Users users)
Construct an AmbariLdapDataPopulator.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addLdapGroup(LdapBatchDto batchInfo,
Map<String,Group> internalGroupsMap,
LdapGroupDto groupDto) |
protected void |
cleanUpLdapUsersWithoutGroup()
Removes synced users which are not present in any of group.
|
protected org.springframework.ldap.filter.Filter |
createCustomMemberFilter(String memberAttributeValue,
String syncMemberFilter)
Use custom member filter.
|
protected org.springframework.ldap.core.support.LdapContextSource |
createLdapContextSource()
LdapContextSource factory method.
|
protected org.springframework.ldap.core.LdapTemplate |
createLdapTemplate(org.springframework.ldap.core.support.LdapContextSource ldapContextSource)
LdapTemplate factory method.
|
protected org.springframework.ldap.control.PagedResultsDirContextProcessor |
createPagingProcessor()
PagedResultsDirContextProcessor factory method.
|
protected Set<LdapGroupDto> |
getExternalLdapGroupInfo()
Retrieves groups from external LDAP server.
|
protected Set<LdapUserDto> |
getExternalLdapUserInfo()
Retrieves users from external LDAP server.
|
protected Map<String,Group> |
getInternalGroups()
Creates a map of internal groups.
|
protected Map<String,User> |
getInternalMembers(String groupName)
Creates a map of internal users present in specified group.
|
protected Map<String,User> |
getInternalUsers()
Creates a map of internal users.
|
protected LdapGroupDto |
getLdapGroupByMemberAttr(String memberAttributeValue)
Get the LDAP group member for the given member attribute.
|
protected Set<LdapGroupDto> |
getLdapGroups(String groupName)
Get the set of LDAP groups for the given group name.
|
LdapSyncDto |
getLdapSyncInfo()
Retrieves information about external groups and users and their synced/unsynced state.
|
protected LdapUserDto |
getLdapUserByMemberAttr(String memberAttributeValue)
Get the LDAP user member for the given member attribute.
|
protected Set<LdapUserDto> |
getLdapUsers(String username)
Get the set of LDAP users for the given user name.
|
protected String |
getUniqueIdByMemberPattern(String memberAttributeValue,
String pattern)
Replace memberAttribute value by a custom pattern to get the DN or id (like memberUid) of a user/group.
|
boolean |
isLdapEnabled()
Check if LDAP is enabled in server properties.
|
protected boolean |
isMemberAttributeBaseDn(String memberAttributeValue)
Determines that the member attribute can be used as a 'dn'
|
protected org.springframework.ldap.core.LdapTemplate |
loadLdapTemplate()
Checks LDAP configuration for changes and reloads LDAP template if they occurred.
|
protected void |
refreshGroupMembers(LdapBatchDto batchInfo,
LdapGroupDto group,
Map<String,User> internalUsers,
Map<String,Group> internalGroupsMap,
Set<String> groupMemberAttributes,
boolean recursive,
boolean collectIgnoredUsers)
Check group members of the synced group: add missing ones and remove the ones absent in external LDAP.
|
LdapBatchDto |
synchronizeAllLdapGroups(LdapBatchDto batchInfo,
boolean collectIgnoredUsers)
Performs synchronization of all groups.
|
LdapBatchDto |
synchronizeAllLdapUsers(LdapBatchDto batchInfo,
boolean collectIgnoredUsers)
Performs synchronization of given sets of all users.
|
LdapBatchDto |
synchronizeExistingLdapGroups(LdapBatchDto batchInfo,
boolean collectIgnoredUsers)
Performs synchronization of existent users and groups.
|
LdapBatchDto |
synchronizeExistingLdapUsers(LdapBatchDto batchInfo,
boolean collectIgnoredUsers)
Performs synchronization of existent users and groups.
|
LdapBatchDto |
synchronizeLdapGroups(Set<String> groups,
LdapBatchDto batchInfo,
boolean collectIgnoredUsers)
Performs synchronization of given set of groupnames.
|
LdapBatchDto |
synchronizeLdapUsers(Set<String> users,
LdapBatchDto batchInfo,
boolean collectIgnoredUsers)
Performs synchronization of given set of user names.
|
protected LdapServerProperties ldapServerProperties
@Inject public AmbariLdapDataPopulator(com.google.inject.Provider<AmbariLdapConfiguration> configurationProvider, Users users)
configurationProvider
- the Ambari configurationusers
- utility that provides access to Userspublic boolean isLdapEnabled()
public LdapSyncDto getLdapSyncInfo()
public LdapBatchDto synchronizeAllLdapGroups(LdapBatchDto batchInfo, boolean collectIgnoredUsers) throws org.apache.ambari.server.AmbariException
collectIgnoredUsers
- true, to collect the set of existing users that would normally be ignored;
false, to continue to ignore themorg.apache.ambari.server.AmbariException
- if synchronization failed for any reasonpublic LdapBatchDto synchronizeAllLdapUsers(LdapBatchDto batchInfo, boolean collectIgnoredUsers) throws org.apache.ambari.server.AmbariException
collectIgnoredUsers
- true, to collect the set of existing users that would normally be ignored;
false, to continue to ignore themorg.apache.ambari.server.AmbariException
- if synchronization failed for any reasonpublic LdapBatchDto synchronizeLdapGroups(Set<String> groups, LdapBatchDto batchInfo, boolean collectIgnoredUsers) throws org.apache.ambari.server.AmbariException
groups
- set of groups to synchronizecollectIgnoredUsers
- true, to collect the set of existing users that would normally be ignored;
false, to continue to ignore themorg.apache.ambari.server.AmbariException
- if synchronization failed for any reasonpublic LdapBatchDto synchronizeLdapUsers(Set<String> users, LdapBatchDto batchInfo, boolean collectIgnoredUsers) throws org.apache.ambari.server.AmbariException
users
- set of users to synchronizecollectIgnoredUsers
- true, to collect the set of existing users that would normally be ignored;
false, to continue to ignore themorg.apache.ambari.server.AmbariException
- if synchronization failed for any reasonpublic LdapBatchDto synchronizeExistingLdapGroups(LdapBatchDto batchInfo, boolean collectIgnoredUsers) throws org.apache.ambari.server.AmbariException
collectIgnoredUsers
- true, to collect the set of existing users that would normally be ignored;
false, to continue to ignore themorg.apache.ambari.server.AmbariException
- if synchronization failed for any reasonpublic LdapBatchDto synchronizeExistingLdapUsers(LdapBatchDto batchInfo, boolean collectIgnoredUsers) throws org.apache.ambari.server.AmbariException
collectIgnoredUsers
- true, to collect the set of existing users that would normally be ignored;
false, to continue to ignore themorg.apache.ambari.server.AmbariException
- if synchronization failed for any reasonprotected void refreshGroupMembers(LdapBatchDto batchInfo, LdapGroupDto group, Map<String,User> internalUsers, Map<String,Group> internalGroupsMap, Set<String> groupMemberAttributes, boolean recursive, boolean collectIgnoredUsers) throws org.apache.ambari.server.AmbariException
batchInfo
- batch update objectgroup
- ldap groupinternalUsers
- map of internal usersgroupMemberAttributes
- set of group member attributes that have already been refreshedrecursive
- if disabled, it won't refresh members recursively (its not needed in case of all groups are processed)collectIgnoredUsers
- true, to collect the set of existing users that would normally be ignored;
false, to continue to ignore themorg.apache.ambari.server.AmbariException
- if group refresh failedprotected Set<LdapGroupDto> getLdapGroups(String groupName)
groupName
- the group nameprotected Set<LdapUserDto> getLdapUsers(String username)
username
- the user nameprotected LdapUserDto getLdapUserByMemberAttr(String memberAttributeValue)
memberAttributeValue
- the member attribute valueprotected LdapGroupDto getLdapGroupByMemberAttr(String memberAttributeValue)
memberAttributeValue
- the member attribute valueprotected org.springframework.ldap.filter.Filter createCustomMemberFilter(String memberAttributeValue, String syncMemberFilter)
protected String getUniqueIdByMemberPattern(String memberAttributeValue, String pattern)
protected void cleanUpLdapUsersWithoutGroup() throws org.apache.ambari.server.AmbariException
org.apache.ambari.server.AmbariException
protected void addLdapGroup(LdapBatchDto batchInfo, Map<String,Group> internalGroupsMap, LdapGroupDto groupDto)
protected boolean isMemberAttributeBaseDn(String memberAttributeValue)
protected Set<LdapGroupDto> getExternalLdapGroupInfo()
protected Set<LdapUserDto> getExternalLdapUserInfo()
protected Map<String,Group> getInternalGroups()
protected Map<String,User> getInternalUsers()
protected Map<String,User> getInternalMembers(String groupName)
groupName
- group nameprotected org.springframework.ldap.core.LdapTemplate loadLdapTemplate()
protected org.springframework.ldap.core.support.LdapContextSource createLdapContextSource()
protected org.springframework.ldap.control.PagedResultsDirContextProcessor createPagingProcessor()
protected org.springframework.ldap.core.LdapTemplate createLdapTemplate(org.springframework.ldap.core.support.LdapContextSource ldapContextSource)
ldapContextSource
- the LDAP context sourceCopyright © 2022 Apache Software Foundation. All rights reserved.