Skip to content

LDAP with admin-plugin 2.0.0 #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# JetBrains Files
.idea
*.iml

/target/

.classpath
.settings
.project
*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# JetBrains Files
.idea
*.iml

/target/

.classpath
.settings
.project
.factorypath
13 changes: 13 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@
<artifactId>cibseven-bpm-spring-boot-starter-rest</artifactId>
<version>${cibseven.version}</version>
</dependency>

<!-- LDAP Identity Plugin -->
<dependency>
<groupId>org.cibseven.bpm.identity</groupId>
<artifactId>cibseven-identity-ldap</artifactId>
<version>${cibseven.version}</version>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
Expand All @@ -42,6 +50,11 @@
<artifactId>jaxb-impl</artifactId>
<version>4.0.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.cibseven.getstarted.loanapproval;
package org.cibseven.getstarted.ldap.admin.plugin;

import org.cibseven.bpm.engine.rest.security.auth.ProcessEngineAuthenticationFilter;
import org.springframework.boot.autoconfigure.web.servlet.JerseyApplicationPath;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package org.cibseven.getstarted.ldap.admin.plugin;

import org.cibseven.bpm.engine.RuntimeService;
import org.cibseven.bpm.engine.impl.plugin.AdministratorAuthorizationPlugin;
import org.cibseven.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin;
import org.cibseven.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.cibseven.bpm.spring.boot.starter.event.PostDeployEvent;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.event.EventListener;

@SpringBootApplication
@EnableProcessApplication
public class WebappExampleProcessApplication {

private static final String LDAP_PREFIX = "camunda.bpm.run.ldap";
private static final String ADMIN_PREFIX = "camunda.bpm.run.admin-auth";

@Bean
@ConditionalOnProperty(name = "enabled", havingValue = "true", prefix = ADMIN_PREFIX)
@ConfigurationProperties(prefix = ADMIN_PREFIX)
public AdministratorAuthorizationPlugin administratorAuthorizationPlugin() {
return new AdministratorAuthorizationPlugin();
}

@Bean
@ConfigurationProperties(prefix = LDAP_PREFIX)
@ConditionalOnProperty(name = "enabled", havingValue = "true", prefix = LDAP_PREFIX)
public LdapIdentityProviderPlugin ldapIdentityProviderPlugin() {
return new LdapIdentityProviderPlugin();
}

/**
* The dependencies of some of the beans in the application context form a cycle:
┌─────┐
| webappExampleProcessApplication (field private org.cibseven.bpm.engine.RuntimeService org.cibseven.getstarted.ldap.admin.plugin.WebappExampleProcessApplication.runtimeService)
↑ ↓
| org.cibseven.bpm.engine.spring.SpringProcessEngineServicesConfiguration (field private org.cibseven.bpm.engine.ProcessEngine org.cibseven.bpm.engine.spring.SpringProcessEngineServicesConfiguration.processEngine)
↑ ↓
| org.cibseven.bpm.spring.boot.starter.CamundaBpmAutoConfiguration$ProcessEngineConfigurationImplDependingConfiguration (field protected org.cibseven.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl org.cibseven.bpm.spring.boot.starter.CamundaBpmAutoConfiguration$ProcessEngineConfigurationImplDependingConfiguration.processEngineConfigurationImpl)
↑ ↓
| processEngineConfigurationImpl defined in class path resource [org/cibseven/bpm/spring/boot/starter/CamundaBpmConfiguration.class]
└─────┘
*/
// @Autowired
// private RuntimeService runtimeService;

public static void main(String... args) {
SpringApplication.run(WebappExampleProcessApplication.class, args);
}

@EventListener
public void processPostDeploy(PostDeployEvent event) {
RuntimeService runtimeService = event.getProcessEngine().getRuntimeService();
runtimeService.startProcessInstanceByKey("loanApproval");
}

}

This file was deleted.

33 changes: 33 additions & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,39 @@ camunda.bpm:
firstName: Demo
filter:
create: All tasks
run:
# https://docs.cibseven.org/manual/latest/user-guide/process-engine/identity-service/#configuration-properties-of-the-ldap-plugin
# https://docs.cibseven.org/manual/latest/user-guide/cibseven-run/#ldap-identity-service
# Uncomment this section to enable LDAP support for CIB seven Run
# ldap:
# enabled: true
# server-url: ldaps://localhost:4334
# accept-untrusted-certificates: false
# manager-dn: uid=jonny,ou=office,o=cibseven,c=org
# manager-password: s3cr3t
# base-dn: o=camunda,c=org
# user-search-base: ''
# user-search-filter: (objectclass=person)
# user-id-attribute: uid
# user-firstname-attribute: cn
# user-lastname-attribute: sn
# user-email-ttribute: mail
# user-password-attribute: userpassword
# group-search-base: ''
# group-search-filter: (objectclass=groupOfNames)
# group-id-attribute: cn
# group-name-attribute: cn
# group-member-attribute: member
# sort-control-supported: false
# https://docs.cibseven.org/manual/latest/user-guide/process-engine/authorization-service/#the-administrator-authorization-plugin
# https://docs.cibseven.org/manual/latest/user-guide/cibseven-run/#ldap-administrator-authorization
# Uncomment this section to grant administrator authorizations to an existing LDAP user or group
# admin-auth:
# enabled: true
# administrator-user-name: admin
# administrator-group-name: admins
# authorization:
# enabled: true # Required for authorization plugin to work

spring:
config:
Expand Down