DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • The Request Timed Out, But the Payment Succeeded: Building Retry-Safe Mobile APIs
  • Integrating OpenAI/GPT Models Into Your Web and Mobile Apps
  • How To Integrate Chatbot With an Android App
  • Guide for Voice Search Integration to Your Flutter Streaming App

Trending

  • Why AI Agents Need a Shared Enterprise Ontology
  • When RabbitMQ Accepts a Message but Does Not Route It to a Queue
  • Why We Chose Iceberg Over Delta After Evaluating Both at Scale
  • Delegated Transport, Forked Authorization: Where Chat and AI-Agent Integrations Actually Break

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. OpenLDAP and Camunda-Spring Boot App Integration in Windows

OpenLDAP and Camunda-Spring Boot App Integration in Windows

A developer gives a step-by-step tutorial on how to create an Open LDAP application and integrate it into an existing app running on Camunda and Spring Boot.

By 
Alok Singh
·
Updated Feb. 10, 21 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
18.6K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

In this article, we'll take a look at a working example of a Camunda-Spring Boot application, going over how to integrate it with LDAP, how to easily check-in with your local setup, and how to use these concepts in higher environments in your projects.

Prerequisites

To test Open LDAP Integration with Camunda on your local Windows machine, you need to have the below tools/software:

  1. Open LDAP for Windows.
  2. Apache Directory Studio (ApacheDS).
  3. Eclipse (for development) with Maven.
  4. Spring Boot 2.0.
  5. Java 8+.

Installing Open LDAP

Download Open LDAP for Windows here. Click on the .exe file to install it. Open LDAP provides five different database options:

  1. BDB (Berkley Database)
  2. MDB (Memory Mapped Database)
  3. LDAP (a proxy ahead of the actual LDAP server)
  4. LDIF (use of LDIF files)
  5. SQL Server 

For this exercise, choose BDB while installing Open LDAP. Make a note to remember the password and Hostname that you set during installation and make sure the service is running on your machine.

Configuring the User Directory Using Apache Directory Studio

Download Apache Directory Studio from here and install it on your machine. Open it up and follow the below steps to complete the configuration.

  1. Open Apache DS. Click on the LDAP -> New Connection menu item. Enter the connection name of your choice along with the Hostname, which is the same as the Hostname we entered while installing Open LDAP. 
  2. Enter the user as cn=Manager,dc=maxcrc,dc=com; the password should be the same as the password you created while installing Open LDAP. 
  3. With this connection setup, the next step is to try to create users for Apache Directory Studio. The connection will look like this: Right click on ou=people and select the option "New Entry" -> Next -> "inetOrgPerson"-> Next. 
  4. The next step is to create some common names under which we can add multiple users. For this, set the value of RDN to cn and give it a value (for this example, "reviewer"). Then click on Next and Finish. If any other value needs to be added feel free to do so. 
  5. To add users in cn=reviewer, repeat steps 4 and 5 and then choose RDN as the uid and provide it with a value. 

You can add other values to it, such as mail, mobile, and userPassword, by clicking on the + symbol.

Now, you have created a user in Open LDAP that can be used to connect to a Camunda application.

Integrating a Camunda Application With Open LDAP

Open your Camunda-Spring Boot Application. If don't have one created, you can use this link to create one.

Add the below LDAP-related dependency to your pom.xml file.

XML
 




xxxxxxxxxx
1
19


 
1
<dependency> 
2
            <groupId>org.camunda.bpm.identity</groupId> 
3
            <artifactId>camunda-identity-ldap</artifactId> 
4
            <version>${camunda-version}</version> 
5
        </dependency>
6
        <dependency> 
7
            <groupId>org.springframework.data</groupId> 
8
            <artifactId>spring-data-ldap</artifactId> 
9
        </dependency> 
10
        <dependency> 
11
            <groupId>org.springframework.ldap</groupId> 
12
            <artifactId>spring-ldap-core</artifactId> 
13
            <exclusions> 
14
                <exclusion> 
15
                    <groupId>commons-logging</groupId> 
16
                    <artifactId>commons-logging</artifactId> 
17
                </exclusion> 
18
            </exclusions> 
19
        </dependency>


Add the below Java code to enable the connection between LDAP and the configuration, as shown below:

Java
 




x


 
1
package com.security;
2
3
import org.camunda.bpm.engine.impl.plugin.AdministratorAuthorizationPlugin;
4
import org.camunda.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin;
5
import org.springframework.context.annotation.Bean;
6
import org.springframework.context.annotation.Configuration;
7
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
8
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
9
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
10
11
@EnableWebSecurity
12
@Configuration
13
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
14
15
    @Override
16
    protected void configure(HttpSecurity http) throws Exception {
17
        http.csrf().disable();
18
        http.authorizeRequests().antMatchers("/").permitAll(); 
19
        http.headers().frameOptions().disable();
20
    }
21
    
22
    @Bean
23
    public static AdministratorAuthorizationPlugin administratorAuthorizationPlugin() {
24
        AdministratorAuthorizationPlugin plugin = new AdministratorAuthorizationPlugin();
25
        plugin.setAdministratorUserName("alok.singh");
26
        return plugin;
27
    }
28
    
29
    @Bean
30
    public static LdapIdentityProviderPlugin ldapIdentityProviderPlugin() {
31
        LdapIdentityProviderPlugin plugin = new LdapIdentityProviderPlugin();
32
        plugin.setServerUrl("ldap://localhost:389");
33
        plugin.setManagerDn("cn=Manager,dc=maxcrc,dc=com");
34
        plugin.setManagerPassword("secret");
35
        plugin.setBaseDn("ou=People,dc=maxcrc,dc=com");
36
        //plugin.setUserSearchBase("ou=People");
37
        plugin.setUserSearchFilter("(objectclass=person)");
38
        plugin.setUserIdAttribute("uid");
39
        plugin.setUserFirstnameAttribute("cn");
40
        plugin.setUserLastnameAttribute("sn");
41
        plugin.setUserPasswordAttribute("userPassword");
42
        //plugin.setGroupSearchBase("ou=Gruppen");
43
        //plugin.setGroupSearchFilter("(member={0})");
44
        //plugin.setGroupIdAttribute("ou");
45
        //plugin.setGroupNameAttribute("cn");
46
        //plugin.setGroupMemberAttribute("member");
47
        //plugin.setAuthorizationCheckEnabled(true);
48
        return plugin;
49
    }   
50
}


YAML
 




xxxxxxxxxx
1


 
1
ldap:
2
  principal: cn=Manager,dc=maxcrc,dc=com
3
  password: secret
4
  port: 389
5
  url: ldap://localhost:389


Start the Sprint Boot application and use the given username/password to login to your Camunda web app (http://localhost:8080/app/welcome) using the same username/password you created while configuring a user in OpenLDAP.

mobile app Integration Apache Directory

Opinions expressed by DZone contributors are their own.

Related

  • The Request Timed Out, But the Payment Succeeded: Building Retry-Safe Mobile APIs
  • Integrating OpenAI/GPT Models Into Your Web and Mobile Apps
  • How To Integrate Chatbot With an Android App
  • Guide for Voice Search Integration to Your Flutter Streaming App

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook