2017-03-16 86 views
1

我想用activiti引擎配置ldap,我跟着the activiti user guide 但我不確定它是否可以測試它我想從Active Directory獲得所有用戶,任何人都可以幫助我嗎?
我使用的Activiti 5.21.0版本和Java
這是我的配置文件LDAP與Activiti的集成

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" 
    xmlns:tx="http://www.springframework.org/schema/tx" 
    xsi:schemaLocation=" 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd 
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> 

    <bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource"> 
    <property name="driverClass" value="org.h2.Driver" /> 
    <property name="url" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" /> 
    <property name="username" value="sa" /> 
    <property name="password" value="" /> 
    </bean> 

    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> 
    <property name="dataSource" ref="dataSource" /> 
    </bean> 

    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration"> 
    <property name="dataSource" ref="dataSource" /> 
    <property name="transactionManager" ref="transactionManager" /> 
    <property name="databaseSchemaUpdate" value="true" /> 
    <property name="jobExecutorActivate" value="false" /> 

    <property name="configurators"> 
      <list> 
       <bean class="org.activiti.ldap.LDAPConfigurator"> 

       <!-- Server connection params --> 
       <property name="server" value="ldap://localhost" /> 
       <property name="port" value="10389" /> 
       <property name="user" value="uid=admin, ou=users, o=activiti" /> 
       <property name="password" value="pass" /> 

       <!-- Query params --> 
       <property name="baseDn" value="o=activiti" /> 
       <property name="queryUserByUserId" value="((objectClass=inetOrgPerson)(uid={0}))" /> 
       <property name="queryUserByFullNameLike" value="((objectClass=inetOrgPerson)(|({0}=*{1}*)({2}=*{3}*)))" /> 
       <property name="queryGroupsForUser" value="((objectClass=groupOfUniqueNames)(uniqueMember={0}))" /> 

       <!-- Attribute config --> 
       <property name="userIdAttribute" value="uid" /> 
       <property name="userFirstNameAttribute" value="cn" /> 
       <property name="userLastNameAttribute" value="sn" /> 
       <property name="userEmailAttribute" value="mail" /> 


       <property name="groupIdAttribute" value="cn" /> 
       <property name="groupNameAttribute" value="cn" /> 

       </bean> 
      </list> 
     </property> 
    </bean> 

    <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean"> 
    <property name="processEngineConfiguration" ref="processEngineConfiguration" /> 
    </bean> 

    <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" /> 
    <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" /> 
    <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" /> 
    <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" /> 
    <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" /> 


</beans> 

回答

2

如果你的目標LDAP是Active Directory作爲你的建議,那麼這行幾乎肯定是不正確。

<property name="user" value="uid=admin, ou=users, o=activiti" /> 

活動目錄基DN通常在DC =域,DC =融爲一體而往往eDirectory中的格式植根與組織對象。

uid = admin節點建議您從與OpenLDAP樣式目錄交談的示例中獲取此信息。 AD中的默認命名是cn = Username(通常cn =事實上是第一個Last)。

+0

好的,謝謝,但你有一個關於如何在java中測試它的想法? –

+0

@WassimMakni首先,修復DN,並確保密碼正確,我假設你已將其屏蔽以供公衆使用。你想從AD得到一個錯誤,說明失敗的原因。所以wathc你的日誌,並嘗試適當的DN。 – geoffc

+0

好,我決定使用Apache目錄工作室爲OpenLDAP的層次結構是 O =魔力 OU =組 CN =管理 CN =用戶 OU =用戶 CN = USER1 CN =用戶2等 可以請你建議我糾正我的配置文件 –