cancel
Showing results for 
Search instead for 
Did you mean: 

How can I integrate Spring Security with Activiti?

zlygy
Champ in-the-making
Champ in-the-making
Hi guys,

I use Spring Security 3 for my project, and now I wanna take advantage of Activiti to model the business work flow. As you know, spring security has its own database schema including the tables like "User","Role","Authority", and I noticed that Activiti5.2 also offered an authentication schema, so I think I need find a way to let both Spring Security and Activiti use the same database schema for authentication, any ideas on this? Thank you in advance.
6 REPLIES 6

zlygy
Champ in-the-making
Champ in-the-making
Maybe these will help:

http://forums.activiti.org/en/viewtopic.php?f=9&t=1174&p=4848&hilit=authentication#p4848
http://forums.activiti.org/en/viewtopic.php?f=6&t=618&hilit=authentication
http://forums.activiti.org/en/viewtopic.php?f=6&t=139&p=513&hilit=authentication#p513

Tom.


Thank you Tom, I think I got the answer as following now:
1: Implement "IdentitySession" interface to create your customized indentity session implementation.
2: Extend ProcessEngineFactoryBean and override the getObject() methods to inject your indentity session.  (I use Sping)

Cheers,
Luyao

walterjs
Champ in-the-making
Champ in-the-making
No need to extend the ProcessEngineFactoryBean, just add a session factory to the ProcessEngineConfiguration. e.g.

configuration.getSessionFactories().put(IdentitySession.class, springSecurityIdentitySession);

zlygy
Champ in-the-making
Champ in-the-making
No need to extend the ProcessEngineFactoryBean, just add a session factory to the ProcessEngineConfiguration. e.g.

configuration.getSessionFactories().put(IdentitySession.class, springSecurityIdentitySession);


Thank you WalterJS, your method is much easier.

re3lex
Champ in-the-making
Champ in-the-making
Hi guys,

I'm using spring+spring security to implement my application.
Now I want to use Activiti in my app with the same roles and users which are managed by spring security.

There is solution how integrate spring security and activiti: need to add to configuration myown custom identity session in some java.

But as I spring, spring security and activiti are configured in spring's app context xml.

My question: how can I define myown custom identity session class in xml?

Looks like I should do it in SpringProcessEngineConfiguration bean definition: this class has public setSessionFactories(Map<Class< ? >, SessionFactory> sessionFactories) method, but I'm not sure how can I pass required params there through xml.

Thanks,
Alexey

walterjs
Champ in-the-making
Champ in-the-making
The way I did this was to let my SessionFactory implement org.springframework.beans.factory.InitializingBean and then do this in afterPropertiesSet:


    public void afterPropertiesSet() throws Exception {
        configuration.getSessionFactories().put(getSessionType(), this);
    }