LDAP with Spring boot

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

LDAP with Spring boot

Hello All,

I know this should be a simple issue but I am stuck up in configuring the LDAP server with Activiti Databse. 

This is what my requirement is:

I am using spring boot 2.0 and activiti 6.0 where the processes are executed by means of activiti. I am trying to assign the process to a User which are present in the LDAP active directory services. I followed the activiti guide and configured the same. 

I dont see any logs for LDAP when i run the application and when i use the below query it returns null. 

LDAP config:

@bean(name="configurators")
@Autowired
public List<ProcessEngineConfigurator> configurators () {

List<ProcessEngineConfigurator> configurators = new ArrayList<ProcessEngineConfigurator>();
LDAPConfigurator ldapConfigurator = new LDAPConfigurator();
ldapConfigurator.setServer(config.getLdapServerUrl());
ldapConfigurator.setPort(Integer.parseInt(config.getLdapPort()));
ldapConfigurator.setSecurityAuthentication("simple");//Not required by default its simple
ldapConfigurator.setUser("admin");
ldapConfigurator.setPassword("test123");
ldapConfigurator.setBaseDn("ou=TEST,dc=TEST,dc=ORG");
ldapConfigurator.setQueryUserByUserId("(&(objectClass=person,user)(uid={0}))");
ldapConfigurator.setQueryUserByFullNameLike("(&(objectClass=person, user)(|({0}=*{1}*)({2}=*{3}*)))");
ldapConfigurator.setQueryGroupsForUser("(&(objectClass=person,  user)(uniqueMember={0}))");
return configurators;

}

 

Test method:

List<User> users = identityService.createUserQuery().list();
User user = identityService.createUserQuery().userId("id1").singleResult();
List<Group> groupList = identityService.createGroupQuery().groupMember("id1").list();

//The above results in null .

Am i missing anything ? How do i figure out whenther activiti is trying to establish the connection to LDAP or not. 

 

Any help appreciated. I 

4 Replies
Highlighted
Community Manager
Community Manager

Re: LDAP with Spring boot

Hi @sarveshmvm,

Have you tried adding log output before & during the method calls - just to ensure your code is being called? 

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!
Highlighted
Active Member II

Re: LDAP with Spring boot

@EddieMay  Hi Eddie , 

I have added the below config into my LDAP configuration and it worked .

Map<String, String> connectionMap = new HashMap<String, String>();
connectionMap.put("InitialDirContext", "Context.REFERRAL");
ldapConfigurator.setCustomConnectionParameters(connectionMap);

I have couple more questions:

1. Integrating activiti with LDAP copy the users to activiti database or its just an authentication on the fly ?

2. I want to implement the custom query . I see Groupmanagerfactory and UserManagerFactory classes are not present in the latest version but it was in the previous versions. What do you suggest for implementing the custom query for activiti 6 with LDAP. Is there any implementation where I can refer to ?

Thanks in advance!!

Highlighted
Community Manager
Community Manager

Re: LDAP with Spring boot

Hi @sarveshmvm,

Great that you resolved one problem! And thanks for posting how you resolved it.

Can I make a suggestion? Start another thread for the new questions. It's because people may have read the original title and think they can't help. However, your subsequent questions may be more relevant to them. 

Good luck!

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!
Highlighted
Active Member II

Re: LDAP with Spring boot

Sure Thanks again for the prompt response