AnsweredAssumed Answered

Activiti 5.3 and Spring Security Integration

Question asked by limcheekin on Mar 7, 2011
Latest reply on Mar 9, 2011 by limcheekin
Hi there,

I try to integrate Activiti and Spring Security by implement a custom SpringProcessEngineConfiguration and Session Factory. Please see the following code:


package org.grails.activiti.springsecurity;

import org.activiti.spring.SpringProcessEngineConfiguration;
import org.activiti.engine.ProcessEngine;
import java.util.ArrayList;

class SpringSecurityProcessEngineConfiguration extends SpringProcessEngineConfiguration {
   public ProcessEngine buildProcessEngine() {
      ArrayList customSessionFactories = new ArrayList(1);
      customSessionFactories.add(new SpringSecurityIdentitySessionFactory());
      setCustomSessionFactories(customSessionFactories);
      return super.buildProcessEngine();
   }
}


package org.grails.activiti.springsecurity;

import org.activiti.engine.impl.interceptor.Session;
import org.activiti.engine.impl.interceptor.SessionFactory;

class SpringSecurityIdentitySessionFactory implements SessionFactory {
  
   public Class<?> getSessionType() {
      return SpringSecurityIdentitySession.class;
   }
   
   public Session openSession() {
      return new SpringSecurityIdentitySession();
   }

}

Then, I configure org.grails.activiti.springsecurity.SpringSecurityProcessEngineConfiguration in spring's application context file to initialize Activiti process engine. Everything seems working fine without any error. But when I run the integration tests of Activiti's identityService, no invocation route to custom SpringSecurityIdentitySession class. Did I missed anything?

Fyi, I am using Activiti 5.3.

Thanks in advance. Wish to hear from you soon!

Best regards,
Chee Kin

Outcomes