AnsweredAssumed Answered

Steps for integrate Activiti with LDAP

Question asked by jcosano on Jun 7, 2011
Latest reply on Jul 23, 2013 by sdwilly22
Hello…

I would explain how I use Activiviti with my corporative LDAP. Maybe this is not the best way, but for me is working and it would be a start point for others…

First of all, I choose a framework for work with LDAP, I consider these:
- jndi
- spring ldap
- UnboundID LDAP SDK
- Novell ldap framework

Finally I get Novell ldap framework (jldapv2.0.1.jar) because I worked with it in old projects.

Then… let's go…

1) Create a own ProcessEngineConfiguration OPTIONAL: ONLY IF YOU NEED A SPECIFIC IDENTITY SERVICE.. NOT MANDATORY

public class LDAPStandaloneProcessEngineConfiguration extends StandaloneProcessEngineConfiguration 
{
   protected IdentityService identityService = new IdentityServiceLDAPImpl();
}

2) Change Activiti.cfg.xml ( note: class should be you ProcessEngineConfiguration class… maybe StandaloneProcessEngineConfiguration )

  <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.ldap.LDAPStandaloneProcessEngineConfiguration">
    <property name="customSessionFactories">
        <list>
       <bean class="org.activiti.engine.impl.ldap.LDAPUserManagerFactory" />
            <bean class="org.activiti.engine.impl.ldap.LDAPGroupManagerFactory" />
        </list>
    </property>
 

3) Create an own IdentityService OPTIONAL: ONLY IF YOU NEED A SPECIFIC IDENTITY SERVICE.. NOT MANDATORY

public class IdentityServiceLDAPImpl extends ServiceImpl implements IdentityService 

In some methods may be you can do this:

throw new LDAPOperationNotSupportedException("This action is not implemented under LDAP");

4) Create LDAPUserManagerFactory

public class LDAPUserManagerFactory implements SessionFactory 
{
   @Override
   public Class<?> getSessionType()
       {
      return UserManager.class; 
   }

   @Override
   public Session openSession()
   {
      return new LDAPUserManager();
   }
}


5) Create LDAPGroupManagerFactory

public class LDAPGroupManagerFactory implements SessionFactory 
{
   @Override
   public Class<?> getSessionType()
       {
      return GroupManager.class; 
   }

   @Override
   public Session openSession()
   {
      return new LDAPGroupManager();
   }
}

6) Create your LDAPUserManager implementing your queries to LDAP using you LDAP framework

public class LDAPUserManager extends org.activiti.engine.impl.persistence.entity.UserManager


7) Create your LDAPGroupManager implementing your queries to LDAP using you LDAP framework

public class LDAPGroupManager extends org.activiti.engine.impl.persistence.entity.GroupManager


And I think… that's all folks

Outcomes