Class LDAPUserRegistry
java.lang.Object
org.alfresco.repo.security.sync.ldap.LDAPUserRegistry
- All Implemented Interfaces:
ActivateableBean,LDAPNameResolver,UserRegistry,org.springframework.beans.factory.InitializingBean
public class LDAPUserRegistry
extends Object
implements UserRegistry, LDAPNameResolver, org.springframework.beans.factory.InitializingBean, ActivateableBean
A
UserRegistry implementation with the ability to query Alfresco-like descriptions of users and groups from an LDAP directory, optionally restricted to those modified since a certain time.- Author:
- dward
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classAn abstract implementation of SearchCallback interface.classWraps the LDAP user query as a virtualCollection.protected static interfaceAn interface for callbacks passed to theprocessQuery(SearchCallback, String, String, String[])method. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidGets the names of all groups in the registry.Gets descriptions of all the groups in the user registry or all those changed since a certain date.Gets the set of property names that are auto-mapped by this user registry.Gets the names of all persons in the registry.getPersons(Date modifiedSince) Gets descriptions of all the persons (users) in the user registry or all those changed since a certain date.booleanisActive()Determines whether this bean is active.static NameConverts a given DN into one suitable for use through JNDI.resolveDistinguishedName(String userId, AuthenticationDiagnostic diagnostic) Resolves a user ID to a distinguished name.voidsetActive(boolean active) Controls whether this bean is active.voidsetAttributeBatchSize(int attributeBatchSize) Sets the attribute batch size.voidsetEnableProgressEstimation(boolean enableProgressEstimation) Controls whether progress estimation is enabled.voidsetErrorOnDuplicateGID(boolean errorOnDuplicateGID) Decides whether to error on duplicate group IDs.voidsetErrorOnMissingGID(boolean errorOnMissingGID) Decides whether to error on missing group IDs.voidsetErrorOnMissingMembers(boolean errorOnMissingMembers) Decides whether to error on missing group members.voidsetErrorOnMissingUID(boolean errorOnMissingUID) Decides whether to error on missing user IDs.voidsetGroupAttributeDefaults(Map<String, String> groupAttributeDefaults) Sets the group attribute defaults.voidsetGroupAttributeMapping(Map<String, String> groupAttributeMapping) Sets the group attribute mapping.voidsetGroupDifferentialQuery(String groupDifferentialQuery) Sets the group differential query.voidsetGroupIdAttributeName(String groupIdAttributeName) Sets the group id attribute name.voidsetGroupQuery(String groupQuery) Sets the group query.voidsetGroupSearchBase(String groupSearchBase) Sets the group search base.voidsetGroupType(String groupType) Sets the group type.voidsetLDAPInitialDirContextFactory(LDAPInitialDirContextFactory ldapInitialDirContextFactory) Sets the LDAP initial dir context factory.voidsetMemberAttribute(String memberAttribute) Sets the member attribute name.voidsetModifyTimestampAttributeName(String modifyTimestampAttributeName) Sets the modification timestamp attribute name.voidsetNamespaceService(NamespaceService namespaceService) Sets the namespace service.voidsetPersonAttributeDefaults(Map<String, String> personAttributeDefaults) Sets the person attribute defaults.voidsetPersonAttributeMapping(Map<String, String> personAttributeMapping) Sets the person attribute mapping.voidsetPersonDifferentialQuery(String personDifferentialQuery) Sets the person differential query.voidsetPersonQuery(String personQuery) Sets the person query.voidsetPersonType(String personType) Sets the person type.voidsetQueryBatchSize(int queryBatchSize) Sets the query batch size.voidsetTimestampFormat(String timestampFormat) Sets the timestamp format.voidsetUserAccountStatusInterpreter(AbstractDirectoryServiceUserAccountStatusInterpreter userAccountStatusInterpreter) voidsetUserIdAttributeName(String userIdAttributeName) Sets the user id attribute name.voidsetUserSearchBase(String userSearchBase) Sets the user search base.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.alfresco.repo.security.sync.UserRegistry
initSync
-
Field Details
-
NAMING_TIMEOUT_EXCEPTION_MESSAGE
- See Also:
-
-
Constructor Details
-
LDAPUserRegistry
public LDAPUserRegistry()Instantiates a new lDAP user registry.
-
-
Method Details
-
setActive
public void setActive(boolean active) Controls whether this bean is active. I.e. should this part of the subsystem be used?- Parameters:
active-trueif this bean is active
-
setEnableProgressEstimation
public void setEnableProgressEstimation(boolean enableProgressEstimation) Controls whether progress estimation is enabled. When enabled, the user query has to be run twice in order to count entries.- Parameters:
enableProgressEstimation-trueif progress estimation is enabled
-
setGroupIdAttributeName
Sets the group id attribute name.- Parameters:
groupIdAttributeName- the group id attribute name
-
setGroupQuery
Sets the group query.- Parameters:
groupQuery- the group query
-
setGroupDifferentialQuery
Sets the group differential query.- Parameters:
groupDifferentialQuery- the group differential query
-
setPersonQuery
Sets the person query.- Parameters:
personQuery- the person query
-
setPersonDifferentialQuery
Sets the person differential query.- Parameters:
personDifferentialQuery- the person differential query
-
setGroupType
Sets the group type.- Parameters:
groupType- the group type
-
setMemberAttribute
Sets the member attribute name.- Parameters:
memberAttribute- the member attribute name
-
setPersonType
Sets the person type.- Parameters:
personType- the person type
-
setGroupSearchBase
Sets the group search base.- Parameters:
groupSearchBase- the group search base
-
setUserSearchBase
Sets the user search base.- Parameters:
userSearchBase- the user search base
-
setUserIdAttributeName
Sets the user id attribute name.- Parameters:
userIdAttributeName- the user id attribute name
-
setModifyTimestampAttributeName
Sets the modification timestamp attribute name.- Parameters:
modifyTimestampAttributeName- the modification timestamp attribute name
-
setTimestampFormat
Sets the timestamp format. Unfortunately, this varies between directory servers.- Parameters:
timestampFormat- the timestamp format- OpenLDAP: "yyyyMMddHHmmss'Z'"
- Active Directory: "yyyyMMddHHmmss'.0Z'"
-
setErrorOnMissingMembers
public void setErrorOnMissingMembers(boolean errorOnMissingMembers) Decides whether to error on missing group members.- Parameters:
errorOnMissingMembers-trueif we should error on missing group members
-
setErrorOnMissingGID
public void setErrorOnMissingGID(boolean errorOnMissingGID) Decides whether to error on missing group IDs.- Parameters:
errorOnMissingGID-trueif we should error on missing group IDs
-
setErrorOnMissingUID
public void setErrorOnMissingUID(boolean errorOnMissingUID) Decides whether to error on missing user IDs.- Parameters:
errorOnMissingUID-trueif we should error on missing user IDs
-
setErrorOnDuplicateGID
public void setErrorOnDuplicateGID(boolean errorOnDuplicateGID) Decides whether to error on duplicate group IDs.- Parameters:
errorOnDuplicateGID-trueif we should error on duplicate group IDs
-
setLDAPInitialDirContextFactory
public void setLDAPInitialDirContextFactory(LDAPInitialDirContextFactory ldapInitialDirContextFactory) Sets the LDAP initial dir context factory.- Parameters:
ldapInitialDirContextFactory- the new LDAP initial dir context factory
-
setNamespaceService
Sets the namespace service.- Parameters:
namespaceService- the namespace service
-
setPersonAttributeDefaults
Sets the person attribute defaults.- Parameters:
personAttributeDefaults- the person attribute defaults
-
setPersonAttributeMapping
Sets the person attribute mapping.- Parameters:
personAttributeMapping- the person attribute mapping
-
setGroupAttributeDefaults
Sets the group attribute defaults.- Parameters:
groupAttributeDefaults- the group attribute defaults
-
setGroupAttributeMapping
Sets the group attribute mapping.- Parameters:
groupAttributeMapping- the group attribute mapping
-
setQueryBatchSize
public void setQueryBatchSize(int queryBatchSize) Sets the query batch size.- Parameters:
queryBatchSize- If positive, indicates that RFC 2696 paged results should be used to split query results into batches of the specified size. Overcomes any size limits imposed by the LDAP server.
-
setAttributeBatchSize
public void setAttributeBatchSize(int attributeBatchSize) Sets the attribute batch size.- Parameters:
attributeBatchSize- If positive, indicates that range retrieval should be used to fetch multi-valued attributes (such as member) in batches of the specified size. Overcomes any size limits imposed by the LDAP server.
-
setUserAccountStatusInterpreter
public void setUserAccountStatusInterpreter(AbstractDirectoryServiceUserAccountStatusInterpreter userAccountStatusInterpreter) -
getUserAccountStatusInterpreter
-
isActive
public boolean isActive()Description copied from interface:ActivateableBeanDetermines whether this bean is active.- Specified by:
isActivein interfaceActivateableBean- Returns:
trueif this bean is active
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
getPersonMappedProperties
Description copied from interface:UserRegistryGets the set of property names that are auto-mapped by this user registry. These should remain read-only for this registry's users in the UI.- Specified by:
getPersonMappedPropertiesin interfaceUserRegistry- Returns:
- the person mapped properties
-
getPersons
Description copied from interface:UserRegistryGets descriptions of all the persons (users) in the user registry or all those changed since a certain date.- Specified by:
getPersonsin interfaceUserRegistry- Parameters:
modifiedSince- if non-null, then only descriptions of users modified since this date should be returned; ifnullthen descriptions of all users should be returned.- Returns:
- a
CollectionofNodeDescriptions of all the persons (users) in the user registry or all those changed since a certain date. The description properties should correspond to those of an Alfresco person node.
-
getPersonNames
Description copied from interface:UserRegistryGets the names of all persons in the registry. Used to detect local persons to be deleted. Note that the treatment of these names will depend on Alfresco's username case-sensitivity setting.- Specified by:
getPersonNamesin interfaceUserRegistry- Returns:
- the person names
-
getGroupNames
Description copied from interface:UserRegistryGets the names of all groups in the registry. Used to detect local groups to be deleted.- Specified by:
getGroupNamesin interfaceUserRegistry- Returns:
- the person names
-
getGroups
Description copied from interface:UserRegistryGets descriptions of all the groups in the user registry or all those changed since a certain date.- Specified by:
getGroupsin interfaceUserRegistry- Parameters:
modifiedSince- if non-null, then only descriptions of groups modified since this date should be returned; ifnullthen descriptions of all groups should be returned.- Returns:
- a
CollectionofNodeDescriptions of all the groups in the user registry or all those changed since a certain date. The description properties should correspond to those of an Alfresco authority node.
-
resolveDistinguishedName
public String resolveDistinguishedName(String userId, AuthenticationDiagnostic diagnostic) throws AuthenticationException Description copied from interface:LDAPNameResolverResolves a user ID to a distinguished name.- Specified by:
resolveDistinguishedNamein interfaceLDAPNameResolver- Parameters:
userId- the user id- Returns:
- the DN
- Throws:
AuthenticationException- if the user ID cannot be resolved
-
jndiName
Converts a given DN into one suitable for use through JNDI. In particular, escapes special characters such as '/' which have special meaning to JNDI.- Parameters:
dn- the dn- Returns:
- the name
- Throws:
InvalidNameException- the invalid name exception
-