Overriding Identity management in activiti 6

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

Overriding Identity management in activiti 6

I'm using activiti community version 6. I made activiti-app to point to same Postgres database where my Django web application is also pointing to. I wanted to use custom Users and groups which my web-application creates instead of act_id_user and act_id_group. I searched and found out that for my use-case I need to implement session factory interface and extend UserEntityManager and GroupEntityManager and register the custom session factories in a configuration file.

But I couldn't find applicationContext.xml file in the activiti-app.war other than web.xml and jboss-deployment-structure.xml files.

Please forgive if this was a very basic question. I need to have common authentication for my web-application and activiti-app. Also, I need to access some of the models (tables) created in my django application in activiti-app. Is it possible in activiti-app community version or should i move to enterprise version. I don't want to use LDAP or SSO authentication mechanism

Please suggest some guidance or tutorial according to this version. 

Thanks a lot

5 Replies
Highlighted
Alfresco Employee

Re: Overriding Identity management in activiti 6

The applicationContext.xml is replaced by annotations in later versions of Spring (java - When will we use applicationContext.xml in Spring? - Stack Overflow ). If you want your classes to be available to Acitiviti then you should make sure they are component-scanned - see Activiti/ApplicationConfiguration.java at 6.0-release · Activiti/Activiti · GitHub 

Regarding custom identity management, here is a guide from version 5 - DeveloperLife: Activiti Authentication And Identity Management Tutorial . There is an example in version 6 - Activiti/modules/activiti-ldap/src/main/java/org/activiti/ldap at 6.0-release · Activiti/Activiti · ... . You could also look at Even after customize user and group, IdentityService still create user in act_id_user and group in a...  and registering my own IdentityService 

Highlighted
Member II

Re: Overriding Identity management in activiti 6

Hi.

Your links almost is not found Smiley Sad.

I'm going to customize user/group in activiti 6. 

This is my ProcessEngineConfig.java file

package org.activiti.custom;


import org.activiti.custom.spring.CustomGroupEntityManager;
import org.activiti.custom.spring.CustomUserEntityManager;
import org.activiti.engine.cfg.AbstractProcessEngineConfigurator;
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.context.annotation.Configuration;

@Configuration
@AutoConfigureBefore(org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class)
public class ProcessEngineConfig extends AbstractProcessEngineConfigurator{

public void beforeInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
System.out.println("ProcessEngineConfig beforeInit with config: " + processEngineConfiguration.getDatabaseType());
}

public void configure(ProcessEngineConfigurationImpl processEngineConfiguration)
{
System.out.println("ProcessEngineConfig configure with config: " + processEngineConfiguration.getDatabaseType());
processEngineConfiguration.setUserEntityManager(new CustomUserEntityManager(processEngineConfiguration));
processEngineConfiguration.setGroupEntityManager(new CustomGroupEntityManager(processEngineConfiguration));
}
}

But When I put my .jar to activiti-app/WEB-INF/lib, nothing happend. My logs not show.

Help me, please

Highlighted
Alfresco Employee

Re: Overriding Identity management in activiti 6

Sorry the branch I was linking to seems to have been removed but there is an equivalent branch. Here is a new link to replace the ApplicationConfiguration class link - Activiti/ApplicationConfiguration.java at 6.x · Activiti/Activiti · GitHub . Note that your "org.activiti.custom" is not included in the componentscan. An updated LDAP example link is Activiti/modules/activiti-ldap/src/main/java/org/activiti/ldap at 6.x · Activiti/Activiti · GitHub 

Highlighted
Member II

Re: Overriding Identity management in activiti 6

Thanks Ryan for your quick reply.

I have research all day, and update as your comments, but nothing happend with my custom code (add @componentScan)

Please help me check my very simple project bellow

activiti-custom/src/main/java/org/activiti/custom at master · long241191/activiti-custom · GitHub 

I have three main files:

org.activiti.custom.ProcessEngineConfig.java   : bootstrap config file to override activiti userSession and groupSession

org.activiti.custom.spring.CustomUserEntityManager.java : custom user manager

org.activiti.custom.spring.CustomGroupEntityManager.java : custom group manager.

After install all maven dependency, I export this project to .jar file (use eclipse, export -> jar).

and I copy .jar file into activiti-app/WEB-INF/lib, and then restart tomcat.

 

But nothing happend, no logs, althought I have create some logs in configure() or beforeInit() function.

Many thanks 

Highlighted
Alfresco Employee

Re: Overriding Identity management in activiti 6

I think you're not seeing your bean register as that ApplicationConfiguration class is explicitly registered in Activiti/WebConfigurer.java at 6.x · Activiti/Activiti · GitHub 

At least for purpose of testing you might be best to clone the 6 branch of the Activiti repository and start it directly (Activiti/modules/activiti-ui at 6.x · Activiti/Activiti · GitHub ) so that you can change things and debug more easily.