AnsweredAssumed Answered

LDAP Synch error: User missing user id attribute DN

Question asked by idahodeq on Jun 20, 2006
Latest reply on Jun 28, 2006 by idahodeq
I have setup NTLM for the login to Alfresco but am now trying to get the LDAP Users and Groups to synchronize with Active Directory.

I am getting an error:  User missing user id attribute DN

org.alfresco.repo.importer.ExportSourceImporterException: Failed to import
   at org.alfresco.repo.importer.ExportSourceImporter.doImport(ExportSourceImporter.java:165)
   at org.alfresco.repo.importer.ImporterJob.execute(ImporterJob.java:36)
   at org.quartz.core.JobRunShell.run(JobRunShell.java:191)
   at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:516)
Caused by: org.alfresco.repo.importer.ExportSourceImporterException: User missing user id attribute DN =CN=Bill Behymer,OU=Users,OU=INEEL Idaho Falls,OU=DEQ,DC=deq,DC=idaho,DC=gov  att = sAMAccountName
   at org.alfresco.repo.security.authentication.ldap.LDAPGroupExportSource.buildGroupsAndRoots(LDAPGroupExportSource.java:476)
   at org.alfresco.repo.security.authentication.ldap.LDAPGroupExportSource.generateExport(LDAPGroupExportSource.java:150)
   at org.alfresco.repo.importer.ExportSourceImporter.doImport(ExportSourceImporter.java:149)
   … 3 more
11:16:10,906 ERROR [org.quartz.core.ErrorLogger] Job (DEFAULT.ldapGroupJobDetail threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.alfresco.repo.importer.ExportSourceImporterException: Failed to import]
   at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
   at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:516)
* Nested Exception (Underlying Cause) —————
org.alfresco.repo.importer.ExportSourceImporterException: Failed to import
   at org.alfresco.repo.importer.ExportSourceImporter.doImport(ExportSourceImporter.java:165)
   at org.alfresco.repo.importer.ImporterJob.execute(ImporterJob.java:36)
   at org.quartz.core.JobRunShell.run(JobRunShell.java:191)
   at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:516)
Caused by: org.alfresco.repo.importer.ExportSourceImporterException: User missing user id attribute DN =CN=Bill Behymer,OU=Users,OU=INEEL Idaho Falls,OU=DEQ,DC=deq,DC=idaho,DC=gov  att = sAMAccountName
   at org.alfresco.repo.security.authentication.ldap.LDAPGroupExportSource.buildGroupsAndRoots(LDAPGroupExportSource.java:476)
   at org.alfresco.repo.security.authentication.ldap.LDAPGroupExportSource.generateExport(LDAPGroupExportSource.java:150)
   at org.alfresco.repo.importer.ExportSourceImporter.doImport(ExportSourceImporter.java:149)
   … 3 more

I don't know if that means my Active Directory doesn't have a DN set for the users it is querying?  That sounds a little weird.  Probably I have a configuration set wrong.

Here is my ldap-authentication-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
   <!– DAO that rejects changes - LDAP is read only at the moment –>
   <bean id="alfDaoImpl" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
      <property name="proxyInterfaces">
         <value>org.alfresco.repo.security.authentication.MutableAuthenticationDao</value>
      </property>
      <property name="transactionManager">
         <ref bean="transactionManager"/>
      </property>
      <property name="target">
         <bean class="org.alfresco.repo.security.authentication.ntlm.NullMutableAuthenticationDao">
            <property name="nodeService">
               <ref bean="nodeService"/>
            </property>
         </bean>
      </property>
      <property name="transactionAttributes">
         <props>
            <prop key="*">${server.transaction.mode.default}</prop>
         </props>
      </property>
   </bean>
   <!– LDAP authentication configuration –>
   <!–
   
    You can also use JAAS authentication for Kerberos against Active Directory or NTLM if you also require single sign on from the
    web browser. You do not have to use LDAP authentication to synchronise groups and users from an LDAP store if it supports other
    authentication routes, like Active Directory.
   
    –>
   <bean id="authenticationComponentImpl" class="org.alfresco.repo.security.authentication.ldap.LDAPAuthenticationComponentImpl">
      <property name="LDAPInitialDirContextFactory">
         <ref bean="ldapInitialDirContextFactory"/>
      </property>
      <property name="userNameFormat">
         <value>sAMAccountName=%s</value>
      </property>
   </bean>
   <!–
   
    This bean is used to support general LDAP authentication. It is also used to provide read only access to users and groups
    to pull them out of the LDAP reopsitory
   
    –>
   <bean id="ldapInitialDirContextFactory" class="org.alfresco.repo.security.authentication.ldap.LDAPInitialDirContextFactoryImpl">
      <property name="initialDirContextEnvironment">
         <map>
            <entry key="java.naming.factory.initial">
               <value>com.sun.jndi.ldap.LdapCtxFactory</value>
            </entry>
            <entry key="java.naming.provider.url">
               <value>ldap://10.220.7.171:389</value>
            </entry>
            <entry key="java.naming.security.authentication">
               <value>simple</value>
            </entry>
            <entry key="java.naming.security.principal">
               <value>query</value>
            </entry>
            <entry key="java.naming.security.credentials">
               <value>xxxxx</value>
            </entry>
         </map>
      </property>
   </bean>
   <!– Ldap Syncronisation support –>
   <!–
       
    There can be more than one stack of beans that import users or groups. For example, it may be easier
    to have a version of ldapPeopleExportSource, and associated beans, for each sub-tree of your ldap directory
    from which you want to import users. You could then limit users to be imported from two or more sub tress and ignore
    users found else where. The same applies to the import of groups.
        
    The defaults shown below are for OpenLDAP.   
       
    –>
   <!– Extract user information from LDAP and transform this to XML –>
   <bean id="ldapPeopleExportSource" class="org.alfresco.repo.security.authentication.ldap.LDAPPersonExportSource">
      <!–
        The query to select objects that represent the users to import.
       
        For Open LDAP, using a basic schema, the following is probably what you want:
        (objectclass=inetOrgPerson)
       
        For Active Directory:
        (objectclass=user)
        –>
      <property name="personQuery">
         <value><![CDATA[(&(objectclass=user)(cn=*)(sn=*)(mail=*)(company=*))]]></value>
         <!–<value>(objectclass=user)</value>–>
      </property>
      <!–
        The seach base restricts the LDAP query to a sub section of tree on the LDAP server.
        –>
      <property name="searchBase">
         <value>dc=deq,dc=idaho,dc=gov</value>
      </property>
      <!–
        The unique identifier for the user.
       
        THIS MUST MATCH WHAT THE USER TYPES IN AT THE LOGIN PROMPT   
       
        For simple LDAP authentication this is likely to be "cn" or, less friendly, "distinguishedName"
       
        In OpenLDAP, using other authentication mechanisms "uid", but this depends on how you map
        from the id in the LDAP authentication request to search for the inetOrgPerson against which
        to authenticate.
       
        In Active Directory this is most likely to be "sAMAccountName"
       
        This property is mandatory and must appear on all users found by the query defined above.
       
        –>
      <property name="userIdAttributeName">
         <value>sAMAccountName</value>
      </property>
      <!– Services –>
      <property name="LDAPInitialDirContextFactory">
         <ref bean="ldapInitialDirContextFactory"/>
      </property>
      <property name="personService">
         <ref bean="personService"/>
      </property>
      <property name="namespaceService">
         <ref bean="namespaceService"/>
      </property>
      <!–
        The path to the location of a space to use as the default home folder.
        This folder should be readable by all users, or a group to which all imported users belong.
        –>
      <property name="defaultHomeFolder">
         <value>/app:company_home</value>
      </property>
      <!–
        This property defines a mapping between attributes held on LDAP user objects and
        the properties of user objects held in the repository. The key is the QName of an attribute in
        the repository, the value is the attribute name from the user/inetOrgPerson/.. object in the
        LDAP repository.    
        –>
      <property name="attributeMapping">
         <map>
            <entry key="cm:userName">
               <!– Must match the same attribute as userIdAttributeName –>
               <value>sAMAccountName</value>
            </entry>
            <entry key="cm:firstName">
               <!– OpenLDAP: "givenName" –>
               <!– Active Directory: "givenName" –>
               <value>givenName</value>
            </entry>
            <entry key="cm:lastName">
               <!– OpenLDAP: "sn" –>
               <!– Active Directory: "sn" –>
               <value>sn</value>
            </entry>
            <entry key="cm:email">
               <!– OpenLDAP: "mail" –>
               <!– Active Directory: "???" –>
               <value>mail</value>
            </entry>
            <entry key="cm:organizationId">
               <!– OpenLDAP: "o" –>
               <!– Active Directory: "???" –>
               <value>company</value>
            </entry>
         </map>
      </property>
   </bean>
   <!– Extract group information from LDAP and transform this to XML –>
   <bean id="ldapGroupExportSource" class="org.alfresco.repo.security.authentication.ldap.LDAPGroupExportSource">
      <!–
        The query to select objects that represent the groups to import.
       
        For Open LDAP, using a basic schema, the following is probably what you want:
        (objectclass=groupOfNames)
       
        For Active Directory:
        (objectclass=group)
        –>
      <property name="groupQuery">
         <value>(objectclass=group)</value>
      </property>
      <!–
        The seach base restricts the LDAP query to a sub section of tree on the LDAP server.
        –>
      <property name="searchBase">
         <value>dc=deq,dc=idaho,dc=gov</value>
      </property>
      <!–
        The unique identifier for the user. This must match the userIdAttributeName on the ldapPeopleExportSource bean above.
        –>
      <property name="userIdAttributeName">
         <value>sAMAccountName</value>
      </property>
      <!–
        An attribute that is a unique identifier for each group found.
        This is also the name of the group with the current group implementation.
        This is mandatory for any groups found.
       
        OpenLDAP: "cn" as it is mandatory on groupOfNames
        Active Directory: "cn"
       
        –>
      <property name="groupIdAttributeName">
         <value>cn</value>
      </property>
      <!–
        The objectClass attribute for group members.
        For each member of a group, the distinguished name is given.
        The object is looked up by its DN. If the object is of this class it is treated as a group.
        –>
      <property name="groupType">
         <value>group</value>
      </property>
      <!–
        The objectClass attribute for person members.
        For each member of a group, the distinguished name is given.
        The object is looked up by its DN. If the object is of this class it is treated as a person.
        –>
      <property name="personType">
         <value>person</value>
      </property>
      <property name="LDAPInitialDirContextFactory">
         <ref bean="ldapInitialDirContextFactory"/>
      </property>
      <property name="namespaceService">
         <ref bean="namespaceService"/>
      </property>
      <!–
        The repeating attribute on group objects (found by query or as sub groups)
        used to define membership of the group. This is assumed to hold distinguished names of
        other groups or users/people; the above types are used to determine this.
       
        OpenLDAP: "member" as it is mandatory on groupOfNames
        Active Directory: "member"
       
        –>
      <property name="memberAttribute">
         <value>member</value>
      </property>
   </bean>
   <!– Job definitions to import LDAP people and groups –>
   <bean id="ldapPeopleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
      <property name="jobDetail">
         <bean id="ldapPeopleJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
            <property name="jobClass">
               <value>org.alfresco.repo.importer.ImporterJob</value>
            </property>
            <property name="jobDataAsMap">
               <map>
                  <entry key="bean">
                     <ref bean="ldapPeopleImport"/>
                  </entry>
               </map>
            </property>
         </bean>
      </property>
      <!– Start after 30 seconds of starting the repository –>
      <property name="startDelay">
         <value>30000</value>
      </property>
      <!– Repeat every hour –>
      <property name="repeatInterval">
         <value>3600000</value>
      </property>
   </bean>
   <bean id="ldapGroupTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
      <property name="jobDetail">
         <bean id="ldapGroupJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
            <property name="jobClass">
               <value>org.alfresco.repo.importer.ImporterJob</value>
            </property>
            <property name="jobDataAsMap">
               <map>
                  <entry key="bean">
                     <ref bean="ldapGroupImport"/>
                  </entry>
               </map>
            </property>
         </bean>
      </property>
      <!– Start after 30 seconds of starting the repository –>
      <property name="startDelay">
         <value>30000</value>
      </property>
      <!– Repeat every hour –>
      <property name="repeatInterval">
         <value>3600000</value>
      </property>
   </bean>
   <!– The bean that imports xml describing people –>
   <bean id="ldapPeopleImport" class="org.alfresco.repo.importer.ExportSourceImporter">
      <property name="importerService">
         <ref bean="importerComponent"/>
      </property>
      <property name="transactionService">
         <ref bean="transactionComponent"/>
      </property>
      <property name="authenticationComponent">
         <ref bean="authenticationComponent"/>
      </property>
      <property name="exportSource">
         <ref bean="ldapPeopleExportSource"/>
      </property>
      <!– The store that contains people - this should not be changed –>
      <property name="storeRef">
         <value>${spaces.store}</value>
      </property>
      <!– The location of people nodes within the store defined above - this should not be changed –>
      <property name="path">
         <value>/${system.system_container.childname}/${system.people_container.childname}</value>
      </property>
      <!– If true, clear all existing people before import, if false update/add people from the xml –>
      <property name="clearAllChildren">
         <value>false</value>
      </property>
      <property name="nodeService">
         <ref bean="nodeService"/>
      </property>
      <property name="searchService">
         <ref bean="searchService"/>
      </property>
      <property name="namespacePrefixResolver">
         <ref bean="namespaceService"/>
      </property>
   </bean>
   <!– The bean that imports xml descibing groups –>
   <bean id="ldapGroupImport" class="org.alfresco.repo.importer.ExportSourceImporter">
      <property name="importerService">
         <ref bean="importerComponent"/>
      </property>
      <property name="transactionService">
         <ref bean="transactionComponent"/>
      </property>
      <property name="authenticationComponent">
         <ref bean="authenticationComponent"/>
      </property>
      <property name="exportSource">
         <ref bean="ldapGroupExportSource"/>
      </property>
      <!– The store that contains group information - this should not be changed –>
      <property name="storeRef">
         <value>${alfresco_user_store.store}</value>
      </property>
      <!– The location of group information in the store above - this should not be changed –>
      <property name="path">
         <value>/${alfresco_user_store.system_container.childname}/${alfresco_user_store.authorities_container.childname}</value>
      </property>
      <!– If true, clear all existing groups before import, if false update/add groups from the xml –>
      <property name="clearAllChildren">
         <value>true</value>
      </property>
      <property name="nodeService">
         <ref bean="nodeService"/>
      </property>
      <property name="searchService">
         <ref bean="searchService"/>
      </property>
      <property name="namespacePrefixResolver">
         <ref bean="namespaceService"/>
      </property>
   </bean>
</beans>

I can tell that its connecting to AD because I see this in the logs:

11:16:03,406 DEBUG [org.alfresco.repo.security.authentication.ldap.LDAPGroupExportSource] Linking GROUP_Cert Publishers
11:16:03,406 DEBUG [org.alfresco.repo.security.authentication.ldap.LDAPGroupExportSource] … CN=ID,OU=Domain Controllers,DC=deq,DC=idaho,DC=gov
11:16:03,453 DEBUG [org.alfresco.repo.security.authentication.ldap.LDAPGroupExportSource] … is member

I'd appreciate any help on this.

Thanks,
Nate

Outcomes