Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

hiddentrue

Note to writer- The following should be copied to the product pages before pulling the page contents:

...

User management functionality is provided by default in all WSO2 Carbon-based products and is configured in the user-mgt.xml file found in the <PRODUCT_HOME>/repository/conf/ directory. This file is shipped with user store manager configurations for all possible user store types (JDBC, read-only LDAP/Active Directory

...

and read-write LDAP

...

/Active directory). The instructions given below explains how to configure a read-only LDAP or Active Directory as the primary user store for the WSO2 server.

...

Info
titleThe default User Store

The primary user store that is configured by default in the user-mgt.xml file is a JDBC user store, which reads/writes into the internal database of the product server. By default, the internal database is H2 for all WSO2 products excluding the Identity Server. This database is used by the Authorization Manager (for user authentication information) as well as the User Store Manager (for defining users and roles). In the case of the WSO2 Identity Server, the default user store is an LDAP (Apache DS) that is shipped with the product.

Note that the RDBMS used in the default configuration can remain as the database used for storing Authorization information.

Follow the given steps to configure a read-only LDAP/AD as the primary user store:

Table of Contents
maxLevel3
minLevel3

Step 1: Setting up the read-only LDAP/AD user store manager

Info
titleBefore you begin
  • If you create the user-mgt.xml file yourself, be sure to save it in the <PRODUCT_HOME>/repository/conf directory.
  • The class attribute for a read-only LDAP/Active Directory is <UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager">. 

...

Uncomment the following user store in the <PRODUCT_HOME>/repository/conf/user-mgt.xml file:
<UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager">. Also, ensure that you comment out the configurations for any other user stores in the same file. 

Given below is a sample for the LDAP/AD user store configuration in read-only mode. You can change the values to match your LDAP/AD. For descriptions of the user store properties, see the related documentation.

Code Block
languagehtml/xml
<UserManager>
 <Realm>
  ...
   <UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager"> 
            <Property name="TenantManager">org.wso2.carbon.user.core.tenant.CommonHybridLDAPTenantManager</Property> 
            <Property name="ReadOnly">true</Property> 
            <Property name="Disabled">false</Property> 
            <Property name="MaxUserNameListLength">100</Property> 
            <Property name="ConnectionURL">ldap://localhost:10389&lt</Property> 
            <Property name="ConnectionName">uid=admin,ou=system</Property> 
            <Property name="ConnectionPassword">admin</Property> 
            <Property name="PasswordHashMethod">PLAIN_TEXT</Property> 
            <Property name="UserSearchBase">ou=system</Property> 
            <Property name="UserNameListFilter">(objectClass=person)</Property> 
            <Property name="UserNameSearchFilter">(&amp;(objectClass=person)(uid=?))</Property> 
            <Property name="UserNameAttribute">uid</Property> 
            <Property name="ReadGroups">true</Property> 
            <Property name="GroupSearchBase">ou=system</Property> 
            <Property name="GroupNameListFilter">(objectClass=groupOfNames)</Property> 
            <Property name="GroupNameSearchFilter">(&amp;(objectClass=groupOfNames)(cn=?))</Property> 
            <Property name="GroupNameAttribute">cn</Property> 
            <Property name="SharedGroupNameAttribute">cn</Property> 
            <Property name="SharedGroupSearchBase">ou=SharedGroups,dc=wso2,dc=org</Property> 
            <Property name="SharedGroupNameListFilter">(objectClass=groupOfNames)</Property> 
            <Property name="SharedTenantNameListFilter">(objectClass=organizationalUnit)</Property> 
            <Property name="SharedTenantNameAttribute">ou</Property> 
            <Property name="SharedTenantObjectClass">organizationalUnit</Property> 
            <Property name="MembershipAttribute">member</Property> 
            <Property name="UserRolesCacheEnabled">true</Property> 
            <Property name="ReplaceEscapeCharactersAtUserLogin">true</Property> 
            <Property name="MaxRoleNameListLength">100</Property> 
            <Property name="MaxUserNameListLength">100</Property> 
            <Property name="SCIMEnabled">false</Property> 
        </UserStoreManager>
 </Realm>
</UserManager> 

...

Update the connection details to match your user store. For example:

Code Block
languagehtml/xml
<Property name="ConnectionURL">ldap://localhost:10389</Property>

For Active Directory, the connectionURL should have the following format:

Code Block
<Property name="ConnectionURL">ldap://<AD host-ip>:<AD_listen_port></Property>
Note

If you are using ldaps (secured) to connect to the Active Directory as shown below, you need to import the certificate of Active Directory to the client-truststore.jks of the WSO2 product. See the topic on configuring keystores for information on how to add certificates to the trust-store.

Code Block
languagexml
<Property name="ConnectionURL">ldaps://10.100.1.100:636</Property>

...

Obtain a user who has permission to read all users/attributes and perform searches on the user store from your LDAP/Active Directory administrator. For example, if the privileged user is AdminLDAP and the password is 2010#Avrudu, update the following sections of the user store configuration as shown below. Note that this user does NOT have to be the system administrator that you define here.

Code Block
languagehtml/xml
<Property name="ConnectionName">uid=AdminLDAP,ou=system</Property>
<Property name="ConnectionPassword">2010#Avrudu</Property>

...

Update <Property name="UserSearchBase"> with the directory name where the users are stored. When LDAP searches for users, it will start from this location of the directory.

Code Block
languagehtml/xml
<Property name="UserSearchBase">ou=system</Property> 

...

Set the attribute to use as the username, typically either cn or uid for LDAP. Ideally, <Property name="UserNameAttribute"> and <Property name="UserNameSearchFilter"> should refer to the same attribute. If you are not sure what attribute is available in your user store, check with your LDAP/Active Directory administrator. 

For example:

Code Block
languagehtml/xml
<Property name="UserNameAttribute">uid</Property>

...

  • Enable the ReadGroups property.

    Code Block
    languagehtml/xml
    <Property name="ReadGroups">true</Property>
  • Set the GroupSearchBase property to the directory name where the Roles are stored. That is, the roles you create using the management console of your product will be stored in this directory location. Also, when LDAP searches for users, it will start from this location of the directory. For example:

    Code Block
    languagehtml/xml
    <Property name="GroupSearchBase">ou=system,CN=Users,DC=wso2,DC=test</Property>
  • Set the GroupSearchFilter and GroupNameAttributes. For example:

    Code Block
    languagehtml/xml
    <Property name="GroupSearchFilter">(objectClass=groupOfNames)</Property>
    <Property name="GroupNameAttribute">cn</Property>
  • Set the MembershipAttribute property as shown below:

    Code Block
    languagehtml/xml
    <Property name="MembershipAttribute">member</Property> 

To read roles based on a backlink attribute, use the following code snipet instead of the above:

Code Block
languagehtml/xml
<Property name="ReadGroups">false</Property>
<Property name="GroupSearchBase">ou=system</Property>
<Property name="GroupSearchFilter">(objectClass=groupOfNames)</Property>
<Property name="GroupNameAttribute">cn</Property>
<Property name="MembershipAttribute">member</Property>

<Property name="BackLinksEnabled">true</Property>
<Property name="MembershipOfAttribute">memberOf</Property> 

...

For Active Directory, you can use <Property name="Referral">follow</Property> to enable referrals within the user store. The AD user store may be partitioned into multiple domains. However, according to the use store configurations in the user-mgt.xml file, we are only connecting to one of the domains. Therefore, when a request for an object is received to the user store, the <Property name="Referral">follow</Property> property ensures that all the domains in the directory will be searched to locate the requested object.

...

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. The <Configuration> section in the user-mgt.xml file contains the super admin information. Update this configuration for the read-only LDAP/AD as explained below.

Code Block
<Configuration>
		<AddAdmin>False</AddAdmin>
        <AdminRole>admin</AdminRole>
        <AdminUser>
             <UserName>AdminSOA</UserName>
       		 <Password>XXXXXX</Password>
        </AdminUser>
        ............
</Configuration> 
  • <AddAdmin>: This should be set to 'False' as it will not be allowed to create users and roles in a read-only user store.
  • <AdminRole>: The admin role you enter here should already exist in the read-only user store. Otherwise, you must enter an internal role, which will be saved to the internal database of the system when the system starts the first time.
  • <AdminUser>: Since we are configuring a read-only LDAP as the primary user store, the user that should have admin permissions is required to be stored in the user store when you start the system for the first time. For example, say a valid username is AdminSOA. Update the <AdminUser> section of your configuration as shown above. You do not have to update the password element as it is already set in the user store.

See the related documentation for more information about the system administrator.

Step 3: Starting the server

Start your server and try to log in as the admin user you specified. The password is the admin user's password in the LDAP server.

Related Topics

...

hiddentrue

Note to writers: Add the following as links to the relevant documentation:

Include Page
Shared:Configuring a Read-Only LDAP User Store (V3)
Shared:Configuring a Read-Only LDAP User Store (V3)

...

  • the user-mgt.xml

...

  •  file for configuring the primary user store.
  • Setting up Keystores: This topics explains how keystores are used in WSO2 products.