Configure a Read-write LDAP userstore¶
WSO2 Identity Server uses the embedded H2 database as the primary user store. This document will guide you to change that to a Read/Write LDAP user store.
Tip
Please read the topic Configuring userstores to get a high-level understanding of the userstores available in WSO2 Identity Server (WSO2 IS).
Configure Read-write LDAP userstore manager¶
The following are the minimum configurations that are needed to be provided to configure the read-write LDAP userstore manager.
Configuration Name | Display Name | Description |
---|---|---|
type | userstore Type | This is the type of the userstore manager that we are using. For read-write LDAP userstore manager. this value should be read_write_ldap_unique_id. |
base_dn | User Search Base | This denotes the DN of the context or object under which the user entries are stored in the userstore. When the userstore searches for users, it will start from this location of the directory. Sample values: ou=Users,dc=wso2,dc=org |
Following are the minimum userstore properties that are needed to be provided to configure Read-only LDAP userstore manager.
Property Id | Primary userstore Property | Secondary userstore Property | Description |
---|---|---|---|
ConnectionURL | connection_url | Connection URL | Connection URL to the user store server. Sample values: |
ConnectionName | connection_name | Connection Name | The username used to connect to the userstore and perform various operations. This user does not need to be an administrator in the userstore or have an administrator role in the WSO2 product that you are using, but this user MUST have permissions to read the user list and users' attributes and to perform search operations on the userstore. The value you specify is used as the DN (Distinguish Name) attribute of the user who has sufficient permissions to perform operations on users and roles in LDAP This property is mandatory. |
ConnectionPassword | connection_password | Connection Password | Password for the ConnectionName user. |
Replace the default user_store
configuration in the <IS_HOME>/repository/conf/deployment.toml
file, as per your ldap server configuration. A sample configuration is given below.
[user_store]
type = "read_write_ldap_unique_id"
base_dn = "ou=system"
connection_url = "ldap://localhost:10389"
connection_name = "uid=admin,ou=system"
connection_password = "admin"
Apart from above properties, WSO2 Identity Server also supports advanced LDAP configurations.
Note
It is important to map the Username
and User ID
claims correctly to the values used for Username Attribute
and User ID Attribute
properties in the userstore configuration for user authentication to work properly.
Claim mappings can be done through the management console as explained in edit claim mapping.
Properties used in Read-write LDAP userstore manager¶
Any of the following properties can be configured for the PRIMARY
userstore by adding them as follows to
<IS-HOME>/repository/conf/deployment.toml
.
[user_store]
<Property-Name> = <Property-Value>
For example :
[user_store]
read_groups = true
Note
In the table given below, the Primary userstore Property
column has the PRIMARY
userstore properties that can be configured in the deployment.toml
file. The Secondary userstore Property
column has the properties that can be configured for a secondary userstore through the Management Console.
Property Id | Primary userstore Property | Secondary userstore Property | Description |
---|---|---|---|
UserEntryObjectClass | user_entry_object_class | User Entry Object Class | Object class used to construct user entries. Default: identityPerson( Is a custom object class defined in WSO2 Identity Server) |
UserNameAttribute | user_name_attribute | Username Attribute | A uniquely identifying attribute that represents the username of the user. Users can be authenticated using their email address, UID, etc. The value of the attribute is considered as the username. Default: uid |
UserIDAttribute | user_id_attribute | User ID Attribute | The attribute used for uniquely identifying a user entry. The value of the attribute is considered as the unique user ID. Default: scimId |
UserNameSearchFilter | user_name_search_filter | User Search Filter | Filtering criteria used to search for a particular user entry. Default : (&(objectClass=identityPerson)(uid=?)) |
UserNameListFilter | user_name_list_filter | User List Filter | Filtering criteria for searching user entries in the userstore. This query or filter is used when doing search operations on users with different search attributes. Default: (objectClass=identityPerson) In this case, the search operation only provides the objects created from the person object class. |
UserDNPattern | user_dn_pattern | User DN Pattern | The pattern for the user's DN, which can be defined to improve the search. When there are many user entries in the LDAP userstore, defining a UserDNPattern provides more impact on performances as the LDAP does not have to travel through the entire tree to find users. Sample values: uid={0},ou=Users,dc=wso2,dc=org |
DisplayNameAttribute | display_name_attribute | Display name attribute | This is an optional property. The Display Name Attribute is the name by which users will be listed when you list users in the management console.
Default: blank |
ReadGroups | read_groups | Read Groups | When WriteGroups is set to falses, this Indicates whether groups should be read from the userstore. If this is disabled by setting it to false, none of the groups in the userstore can be read, and the following group configurations are NOT mandatory: GroupSearchBase, GroupNameListFilter, or GroupNameAttribute. Default: true
|
WriteGroups | write_groups | Write Groups | Indicates whether groups should be write to the userstore. Default: true
|
GroupSearchBase | group_search_base | Group Search Base | DN of the context or object under which the group entries are stored in the userstore. When the userstore searches for groups, it will start from this location of the directory Default: ou=Groups,dc=wso2,dc=org |
GroupEntryObjectClass | group_entry_object_class | Group Entry Object Class | Object class used to construct group entries. Default: groupOfNames |
GroupNameAttribute | group_name_attribute | Group Name Attribute | Attribute used for uniquely identifying a group entry. This attribute is to be treated as the group name.
Default: cn |
GroupNameSearchFilter | group_name_search_filter | Group Search Filter | Filtering criteria used to search for a particular group entry. Default: (&(objectClass=groupOfNames)(cn=?)) |
GroupNameListFilter | group_name_list_filter | Group List Filter | Filtering criteria for searching group entries in the userstore. This query or filter is used when doing search operations on groups with different search attributes. Default: ((objectClass=groupOfNames)) In this case, the search operation only provides the objects created from the groupOfName object class. |
RoleDNPattern | role_dn_pattern | Role DN Pattern | The pattern for the group's DN, which can be defined to improve the search. When there are many group entries in the LDAP userstore, defining a RoleDNPattern provides more impact on performances as the LDAP does not have to traverse through the entire tree to findgroup. Sample values: cn={0},ou=Groups,dc=wso2,dc=org |
MembershipAttribute | membership_attribute | Membership Attribute | Defines the attribute that contains the distinguished names (DN) of user objects that are in a group. Default: member |
MemberOfAttribute | member_of_attribute | Member Of Attribute | Define the attribute that contains the distinguished names (DN ) of group objects that user is assigned to. Possible values: memberOf |
BackLinksEnabled | back_links_enabled | Enable Back Links | Defines whether the backlink support is enabled. If you are using MemberOfAttribute attributes this should be set to 'true'.
Default : false |
UsernameJavaRegEx | username_java_regex | Username RegEx (Java) | The regular expression used by the back-end components for username validation. By default, strings with non-empty characters have a length of 3 to 30 allowed. You can provide ranges of alphabets, numbers and also ranges of ASCII values in the RegEx properties. Default: [a-zA-Z0-9._\-|//]{3,30}$ |
UsernameJava ScriptRegEx |
username_java_ script_regex |
Username RegEx (Javascript) | The regular expression used by the front-end components for username validation. Default: ^[\S]{3,30}$ |
UsernameJavaReg ExViolationErrorMsg |
username_java_reg_ ex_violation_error_msg |
Username RegEx Violation Error Message | Error message when the Username is not matched with UsernameJavaRegEx Default: Username pattern policy violated |
PasswordJavaRegEx | password_java_regex | Password RegEx (Java) | The regular expression used by the back-end components for password validation. By default, strings with non-empty characters have a length of 5 to 30 allowed. You can provide ranges of alphabets, numbers and also ranges of ASCII values in the RegEx properties. Default: ^[\S]{5,30}$ |
PasswordJava ScriptRegEx |
password_java_ script_regex |
Password RegEx (Javascript) | The regular expression used by the front-end components for password validation. Default: ^[\S]{5,30}$ |
PasswordJavaReg ExViolationErrorMsg |
password_java_reg ex_violation_error_msg |
Password RegEx Violation Error Message | Error message when the Password is not matched with passwordJavaRegEx Default: Password length should be within 5 to 30 characters |
RolenameJavaRegEx | rolename_java_regex | Role Name RegEx (Java) | The regular expression used by the back-end components for role name validation. By default, strings with non-empty characters have a length of 3 to 30 allowed. You can provide ranges of alphabets, numbers and also ranges of ASCII values in the RegEx properties. Default: [a-zA-Z0-9._\-|//]{3,30}$ |
PasswordHashMethod | password_hash_method | Password Hashing Algorithm | Specifies the Password Hashing Algorithm used the hash the password before storing in the userstore. If you just configure as SHA, It is considered as SHA-1, It is always better to configure algorithm with higher bit value as digest bit size would be increased. |
MultiAttributeSeparator | multi_attribute_separator | Multiple Attribute Separator | This property is used to define a character to separate multiple attributes. This ensures that it will not appear as part of a claim value. Normally “,” is used to separate multiple attributes, but you can define ",,," or "..." or a similar character sequence Default: “,” |
MaxUserName ListLength |
max_user_name _list_length |
Maximum User List Length | Controls the number of users listed in the userstore of a WSO2 product. This is useful when you have a large number of users and don't want to list them all. Setting this property to 0 displays all users. Default: 100 In some userstores, there are policies to limit the number of records that can be returned from the query. Setting the value 0 it will list the maximum results returned by the userstore. If you need to increase that you need to set it in the userstore level. Eg : Active directory has the MaxPageSize property with the default value 1000. |
MaxRoleName ListLength |
max_role_name _list_length |
Maximum Role List Length | Controls the number of roles listed in the userstore of a WSO2 product. This is useful when you have a large number of roles and don't want to list them all. Setting this property to 0 displays all roles. Eg: Active directory has the MaxPageSize property with the default value 1000. |
kdcEnabled | kdc_enabled | Enable KDC | If your userstore is capable of acting as a Kerberos, Key Distribution Center (KDC) and if you like to enable it, set this property to true. Default: false |
UserRoles CacheEnabled |
user_roles _cache_enabled |
Enable User Role Cache | This is to indicate whether to cache the role list of a user. Default: true Possible values: false: Set it to false if the user roles are changed by external means and those changes should be instantly reflected in the Carbon instance. Default: true |
ConnectionPooling Enabled |
connection_pooling _enabled |
Enable LDAP Connection Pooling | Define whether LDAP connection pooling is enabled Possible values: True: Enable connection pooling. Enabling it will improve the performance False: Disable connection pooling Default: false |
LDAPConnectionTimeout | ldap_connection_timeout | LDAP Connection Timeout | Timeout in making the initial LDAP connection. This is configured in milliseconds. Default: 5000 |
ReadTimeout | read_timeout | LDAP Read Timeout | The value of this property is the read timeout in milliseconds for LDAP operations. If the LDAP provider cannot get a LDAP response within that period, it aborts the read attempt. The integer should be greater than zero. An integer less than or equal to zero means no read timeout is specified which is equivalent to waiting for the response infinitely until it is received.
Default: not configured |
MembershipAttributeRange | membership_attribute_range | Membership Attribute Range | This is to define the maximum users of role returned by the LDAP/AD userstore. This does not depend on the max page size of the userstore. Default: not configured |
RetryAttempts | retry_attempts | Retry Attempts | Retry the authentication request if a timeout happened
Default: not configured |
LDAPConnection Timeout |
ldap_connection _timeout |
LDAP Connection Timeout | If the connection to the LDAP is inactive for the length of time
(in milliseconds) specified by this property, the connection
will be terminated.
Default: not configured Sample: 20 |
Update the system administrator¶
The admin user is the super tenant that will be able to manage all other users, roles, and permissions in the system by using the management console of the product. Therefore, the user that should have admin permissions is required to be stored in the userstore when you start the system for the first time. Since the LDAP userstore can be written to, you have the option of creating a new admin user in the userstore when you start the system for the first time. Alternatively, you can also use a user ID that already exists in the LDAP. For information about the system administrator user, see Configuring the System Administrator.
These two alternative configurations can be done as explained below.
-
If you are using a user that is already in the LDAP. Find a valid user that already resides in the userstore. For example, say a valid username is AdminSOA.Add the following configuration to the
deployment.toml
file as shown below. You do not have to update the password element as it is already set in the userstore.[super_admin] username = "AdminSOA" admin_role = "admin" create_admin_account = false
-
if you are creating a new admin user in the userstore when you start the system. you can add the super tenant user to the userstore. Add the following configuration to the
deployment.toml
file as shown below.[super_admin] username = "AdminSOA" admin_role = "admin" create_admin_account = true password = admin