The identity service is an API abstraction over various user/group repositories. The basic entities are

  • User: a user identified by a unique Id
  • Group: a group identified by a unique Id
  • Membership: the relationship between users and groups
  • Tenant: a tenant identified by a unique Id
  • Tenant Membership: the relationship between tenants and users/groups
    Example:
  1. User demoUser = processEngine.getIdentityService()
  2. .createUserQuery()
  3. .userId("demo")
  4. .singleResult();

Camunda BPM distinguishes between read-only and writable user repositories. A read-only user repository provides read-only access to the underlying user/group database. A writable user repository allows write access to the user database which includes creating, updating and deleting users and groups.

To provide a custom identity provider implementation, the following interfaces can be implemented:

The database identity service uses the process engine database for managing users and groups. This is the default identity service implementation used if no alternative identity service implementation is provided.

The database identity service implements both ReadOnlyIdentityProvider and WritableIdentityProvider providing full CRUD functionality in Users, Groups and Memberships.

The LDAP Identity Service

The LDAP identity service provides read-only access to an LDAP-based user/group repository. The identity service provider is implemented as a Process Engine Plugin and can be added to the process engine configuration. In that case it replaces the default database identity service.

To use the LDAP identity service, the camunda-identity-ldap.jar library has to be added to the classloader of the process engine.

Please import the Camunda BOM to ensure correct versions for every Camunda project.

  1. <dependency>
  2. <groupId>org.camunda.bpm.identity</groupId>
  3. <artifactId>camunda-identity-ldap</artifactId>
  4. </dependency>

Activate the LDAP Plugin

The following is an example of how to configure the LDAP Identity Provider Plugin using Spring XML:

  1. <beans xmlns="http://www.springframework.org/schema/beans"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
  4. <bean id="processEngineConfiguration" class="org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
  5. ...
  6. <property name="processEnginePlugins">
  7. <list>
  8. <ref bean="ldapIdentityProviderPlugin" />
  9. </list>
  10. </property>
  11. </bean>
  12. <bean id="ldapIdentityProviderPlugin" class="org.camunda.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin">
  13. <property name="serverUrl" value="ldap://localhost:3433/" />
  14. <property name="managerDn" value="uid=daniel,ou=office-berlin,o=camunda,c=org" />
  15. <property name="managerPassword" value="daniel" />
  16. <property name="baseDn" value="o=camunda,c=org" />
  17. <property name="userSearchBase" value="" />
  18. <property name="userSearchFilter" value="(objectclass=person)" />
  19. <property name="userIdAttribute" value="uid" />
  20. <property name="userFirstnameAttribute" value="cn" />
  21. <property name="userLastnameAttribute" value="sn" />
  22. <property name="userEmailAttribute" value="mail" />
  23. <property name="userPasswordAttribute" value="userpassword" />
  24. <property name="groupSearchBase" value="" />
  25. <property name="groupSearchFilter" value="(objectclass=groupOfNames)" />
  26. <property name="groupIdAttribute" value="ou" />
  27. <property name="groupNameAttribute" value="cn" />
  28. <property name="groupMemberAttribute" value="member" />
  29. <property name="authorizationCheckEnabled" value="false" />
  30. </bean>
  31. </beans>

The following is an example of how to configure the LDAP Identity Provider Plugin in bpm-platform.xml/processes.xml:

  1. <process-engine name="default">
  2. <job-acquisition>default</job-acquisition>
  3. <configuration>org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration</configuration>
  4. <datasource>java:jdbc/ProcessEngine</datasource>
  5. <properties>...</properties>
  6. <plugins>
  7. <plugin>
  8. <class>org.camunda.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin</class>
  9. <properties>
  10. <property name="serverUrl">ldap://localhost:4334/</property>
  11. <property name="managerDn">uid=jonny,ou=office-berlin,o=camunda,c=org</property>
  12. <property name="managerPassword">s3cr3t</property>
  13. <property name="baseDn">o=camunda,c=org</property>
  14. <property name="userSearchBase"></property>
  15. <property name="userSearchFilter">(objectclass=person)</property>
  16. <property name="userIdAttribute">uid</property>
  17. <property name="userFirstnameAttribute">cn</property>
  18. <property name="userLastnameAttribute">sn</property>
  19. <property name="userEmailAttribute">mail</property>
  20. <property name="userPasswordAttribute">userpassword</property>
  21. <property name="groupSearchBase"></property>
  22. <property name="groupSearchFilter">(objectclass=groupOfNames)</property>
  23. <property name="groupIdAttribute">ou</property>
  24. <property name="groupNameAttribute">cn</property>
  25. <property name="groupMemberAttribute">member</property>
  26. <property name="authorizationCheckEnabled">false</property>
  27. </properties>
  28. </plugin>
  29. </plugins>
  30. </process-engine>

Administrator Authorization Plugin

The LDAP Identity Provider Plugin is usually used in combination with the Administrator Authorization Plugin which allows you to grant administrator authorizations for a particular LDAP User/Group.

Multi-Tenancy

Currently, the LDPA Identity Service doesn’t support multi-tenancy. That means it is not possible to get tenants from LDAP and the transparent multi-tenancy access restrictions don’t work by default.

Configuration Properties of the LDAP Plugin

The LDAP Identity Provider provides the following configuration properties:

Property Description
serverUrl The url of the LDAP server to connect to.
managerDn The absolute DN of the manager user of the LDAP directory.
managerPassword The password of the manager user of the LDAP directory
baseDn

The base DN: Identifies the root of the LDAP directory. Is appended to all DN names composed for searching for users or groups.

Example: o=camunda,c=org

|userSearchBase|
Identifies the node in the LDAP tree under which the plugin should search for users. Must be relative to baseDn.

Example: ou=employees

|userSearchFilter|
LDAP query string used when searching for users. Example: (objectclass=person)

|userIdAttribute|
Name of the user Id property. Example: uid

|userFirstnameAttribute|
Name of the firstname property. Example: cn

|userLastnameAttribute|
Name of the lastname property. Example: sn

|userEmailAttribute|
Name of the email property. Example: mail

|userPasswordAttribute|
Name of the password property. Example: userpassword

|groupSearchBase|
Identifies the node in the LDAP tree under which the plugin should search for groups. Must be relative to baseDn.

Example: ou=roles

|groupSearchFilter|
LDAP query string used when searching for groups. Example: (objectclass=groupOfNames)

|groupIdAttribute|
Name of the group Id property. Example: ou

|groupNameAttribute|
Name of the group Name property. Example: cn

|groupTypeAttribute|
Name of the group Type property. Example: cn

|groupMemberAttribute|
Name of the member attribute. Example: member

|acceptUntrustedCertificates|
Accept of untrusted certificates if LDAP server uses SSL. Warning: We strongly advise against using this property. Better install untrusted certificates to JDK key store.

|useSsl|
Set to true if LDAP connection uses SSL. Default: false

|initialContextFactory|
Value for the java.naming.factory.initial property. Default: com.sun.jndi.ldap.LdapCtxFactory

|securityAuthentication|
Value for the java.naming.security.authentication property. Default: simple

|usePosixGroups|
Indicates whether posix groups are used. If true, the connector will use a simple (unqualified) user id when querying for groups by group member instead of the full DN. Default: false

|allowAnonymousLogin|
Allows to login anonymously without a password. Default: false

Warning: We strongly advise against using this property. You should configure your LDAP to use simple authentication without anonymous login.

|authorizationCheckEnabled|
If this property is set to true, then authorization checks are performed when querying for users or groups. Otherwise authorization checks are not performed when querying for users or groups. Default: true

Note: If you have a huge amount of LDAP users or groups we advise to set this property to false to improve the performance of the user and group query.

|sortControlSupported|
If this property is set to true, then ordering of the search results is enabled. Otherwise orderBy clauses in search queries are simply ignored. Default: false

Note: The support of search result ordering is not be implemented by every LDAP server. Make sure that your currently used LDAP Server implements the RFC 2891.

Throttle login attempts

A mechanism exists for preventing subsequent unsuccessful login attempts.The essence of it is that the user is not able to log in for a specific amount of time after unsuccessful login attempts.The amount of time is calculated after each attempt but it is limited by maximum delay time.After a predefined number of unsuccessful attempts, the user will be locked and only an administrator has permissions to unlock them.

The mechanism is configurable with the following properties and respective default values.

  • loginMaxAttempts=10
  • loginDelayFactor=2
  • loginDelayMaxTime=60
  • loginDelayBase=3
    For more information, please check the process engine’s login properties section.

Calculation of the delay is done via the formula: baseTime * factor^(attempt-1).The behaviour with the default configuration will be:3 seconds delay after the first unsuccessful attempt, 6 seconds after the 2nd attempt, 12 seconds, 24 seconds, 48 seconds, 60 seconds, 60 seconds, etc. After the 10th attempt, if the user fails to login again, the user will be locked.

LDAP specifics

If you have a LDAP setup on your engine, you need to handle the throttling on the LDAP side. The login mechanism in your system will not be affected by the above properties.

原文: https://docs.camunda.org/manual/7.9/user-guide/process-engine/identity-service/