cancel
Showing results for 
Search instead for 
Did you mean: 

LDAP custom configuration in 5.14

yuryshaban
Champ in-the-making
Champ in-the-making
Good afternoon.

The problem is:
i'm trying to write my own LDAPGroupManager and LDAPUserManager (with their factories).
My classes are implemented very simple - MyLdapXXX extends org.activiti.ldap.LDAPXXX.

Before trying to exchange standard ones with mine, Activiti with LDAP worked fine: methods as checkPassword, userQuery().userId("…") worked correct according to data from my LDAP, even Activiti Explorer read authentification from my LDAP (worked on similad LDAP settings as my test application).

But after setting ldapGroupManagerFactory, ldapUserManagerFactory method ProcessEngines.getDefaultProcessEngine() is returning null (silence in GlassFish4 console).
I do understand, that I'm doing something wrong in my activiti.cfg.xml, but can't find what. Smiley Sad

Could someone share full activiti.cfg.xml with correctly set custom ldapGroupManagerFactory and ldapUserManagerFactory.

Thanks in advance.
3 REPLIES 3

yuryshaban
Champ in-the-making
Champ in-the-making
OOps… It's my innattention.

(accidentaly was dropped id="processEngineConfiguration" from bean configuration).
Now my LDAP group manager works fine.

Anyhow, if anybody needs the activity.cfg.xml example - here is my one (with Oracle DB configuration):

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

<bean id="processEngineConfiguration"
  class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">

  <property name="jdbcUrl" value="jdbcSmiley Surprisedracle:thin:@//[DATABASE_IP]:1521/FOR" />
  <property name="jdbcDriver" value="oracle.jdbc.OracleDriver" />
  <property name="jdbcUsername" value="bpm_engine" />
  <property name="jdbcPassword" value="[ORACLE_SCHEME_PASSWORD]" />

  <property name="databaseSchemaUpdate" value="false" />
  <property name="jobExecutorActivate" value="true" />

  <property name="configurators">
   <list>
    <bean class="org.activiti.ldap.LDAPConfigurator">
     <property name="server" value="ldap://[LDAP_PROVIDER_IP]" />
     <property name="port" value="[LDAP_PROVIDER_PORT]" />
     <property name="user" value="CN=Admin" />
     <property name="password" value="[LDAP_USER_PASSWORD]" />

     <!– Query params –>
     <property name="baseDn" value="DC=base_domain" />
     <property name="queryUserByUserId"
      value="(&amp;(objectClass=inetOrgPerson)(uid={0}))" />
     <property name="queryUserByFullNameLike"
      value="(&amp;(objectClass=inetOrgPerson)(|({0}=*{1}*)({2}=*{3}*)))" />
     <property name="queryGroupsForUser"
      value="(&amp;(objectClass=groupOfUniqueNames)(uniqueMember={0}))" />


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

     <property name="groupIdAttribute" value="cn" />
     <property name="groupNameAttribute" value="cn" />
    
     <property name="ldapUserManagerFactory" ref="userManagerFactoryBean"/>
     <property name="ldapGroupManagerFactory" ref="groupManagerFactoryBean"/>
    </bean>
   </list>
  </property>
</bean>

<bean id="ldapConfigBean" class="org.activiti.ldap.LDAPConfigurator" />

<bean id="groupManagerFactoryBean" class="by.softclub.activiti.test.ldap.LdapGroupManagerFactory">
  <constructor-arg name="ldapConfigurator" ref="ldapConfigBean" />
</bean>

<bean id="userManagerFactoryBean" class="by.softclub.activiti.test.ldap.LdapUserManagerFactory">
  <constructor-arg name="ldapConfigurator" ref="ldapConfigBean" />
</bean>
</beans>
</code>

P.S. [XXX] - values to be replaced with real values.

jbarrez
Star Contributor
Star Contributor
Great to hear it worked for you. Thanks for posting back your solution!

fatma19
Confirmed Champ
Confirmed Champ

Hi,I am currently devloping a java web application based on activiti and i want to use ldap as an authentification system.

I Configured ldap as it its 's shown,but when i write this command in java System.out.println(processEngine.getIdentityService().createGroupQuery().list().size());  i got an  error "This query is not supported by the LDAPGroupManager".So what can i do ? 

Thank you in advance 

<?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=system" />
<property name="password" value="secret" />

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

 

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

<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>