Skip to main content
Prerequisites

Basic configuration

LDAP backend is defined in the ldapAuthDataSources: subsection of the usernamePasswordAuthBackends: section in the auth/auth/auth.yml file. First, you have to set up the basic parameters of your LDAP source, starting with its name—that can be whatever you like (myLDAP in this sample case)—and then configuring the connection as in the example below:
auth.yml
The following table explains the parameters:

Authentication

The next step involves user authentication in your LDAP server. You can use a direct distinguished name (DN) of a user who is being authenticated (if you already know what the DN of a user looks like) or query LDAP for the DN. Either way, you have to specify only one method. This is done within the authentication: subsection of your LDAP server configuration.

Direct DN

If you want to use a direct DN of a user, you just set the withUserDn.userDnPattern attribute to a pattern which will allow to deduct a DN from a login username string, e.g., "uid={0},ou=users,dc=company,dc=com", where {0} will be substituted with a username:
auth.yml

DN query

When a DN of a user is not known, you can search the LDAP directory for the user entry using a so-called technical user for authentication. Once the user entry is found, their DN is used to authenticate with the provided credentials. A sample configuration of a DN query is as follows:
auth.yml
The table below explains the parameters:

Authorization

After a successful authentication, a user has to be authorized: their roles are read from the LDAP backend. In the authorization.query: subsection, you can configure the parameters of the role search using a nested search within a subtree of a directory as in the sample configuration below:
auth.yml
The parameters are explained in the table below:

Attribute mapping

In the next step you have to map (assign) attributes from the LDAP user entries to the user model in xorlab Security Platform. The mapping is described using Spring expression language and is configured under the attributeMapping: subsection. You can use these methods:
  • attr('<name>'): retrieve the attribute with the '<name>' name from attributes in the source authorization system
  • replace(<string or list of strings>, '<pattern>', 'replace'): replace every occurrence of '<pattern>' with 'replace' in an input string or a list of input strings
  • azureAdEmails(): read all email addresses from the Azure Active Directory proxyAddresses attribute.
Literal values have to be quoted, e.g., key: 'literal value'. A sample configuration for attribute mapping, which simply retrieves attributes from the auth system, would look like this:
auth.yml
Available attributes are explained in the table below:

Role mapping

The last step is to configure role mapping. You must map all roles served by the LDAP directory to the corresponding xorlab roles under the roleMapping: subsection. Roles that are not mapped are ignored by default. Multiple xorlab roles can be mapped to the same LDAP role, e.g., xcc_logincompany1-group1, xcc_admincompany1-group1.
The role mapping is case sensitive, therefore make sure that you specify the role names according to what is served by the LDAP directory.
A sample role mapping configuration is shown below:
auth.yml
If the LDAP directory already serves roles compatible with xorlab (see Built-in Roles), you can also specify a “pass-through” role-mapping mode using roleMappingMode: PASS_THROUGH.
Please be aware that in the pass-through role-mapping mode, all roles served by the LDAP directory are added to the xorlab authorization context. If this context is becoming too large, i.e., too many irrelevant roles are added, then it might lead to errors and users being unable to access XCC. Therefore, it is advisable to only map the roles that are relevant to xorlab.
A sample role mapping configuration using the pass-through mode:
auth.yml

Activate the configuration

After updating auth/auth/auth.yml, click Publish. The authentication configuration becomes active within about one minute.

Multi-Tenancy

The setup on this page applies unchanged in a multi-tenant deployment. Two things are added on top: a tenant entry in the Attribute mapping that matches the tenant name in guarded_tenants.yml, and a tenant-restricted user role in the Role mapping.

Enable Tenant Login

Complete per-tenant LDAP example, and the other login options available to tenants.

Example configuration

The final configuration for an LDAP backend should look like this:
auth.yml