Versions Compared

Key

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

...

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 of each EI profile. This file is shipped with user store manager configurations for all possible user store types (JDBC, read-only LDAP/Active Directory, read-write LDAP and read-write 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.

...

titleThe default User Store

...

server

...

.

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

...

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">. 
  1. 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. 

  2. 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 on each of the properties used in the <PRODUCT_HOME>/repository/conf/user-mgt.xml file , file which are used for configuring the primary user store, see Properties of User Stores.

    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="ConnectionURL">ldap://localhost:10389</Property>
                <Property name="ConnectionName">uid=admin,ou=system</Property>
                <Property name="ConnectionPassword">admin</Property>
                <Property name="AnonymousBind">false</Property>
                <Property name="UserSearchBase">ou=system</Property>
                <Property name="UserNameAttribute"></Property>
                <Property name="UserNameSearchFilter">(&amp;(objectClass=person)(uid=?))</Property>
                <Property name="UserNameListFilter">(objectClass=person)</Property>
                <Property name="DisplayNameAttribute"/>
                <Property name="ReadGroups">true</Property>
                <Property name="GroupSearchBase">ou=system</Property>
                <Property name="GroupNameAttribute">cn</Property>
                <Property name="GroupNameSearchFilter">(&amp;(objectClass=groupOfNames)(cn=?))</Property>
                <Property name="GroupNameListFilter">(objectClass=groupOfNames)</Property>
                <Property name="MembershipAttribute">member</Property>
                <Property name="BackLinksEnabled">false</Property>
                <Property name="UsernameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
                <Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
                <Property name="RolenameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
                <Property name="SCIMEnabled">false</Property>
                <Property name="PasswordHashMethod">PLAIN_TEXT</Property>
                <Property name="MultiAttributeSeparator">,</Property>
                <Property name="MaxUserNameListLength">100</Property>
                <Property name="MaxRoleNameListLength">100</Property>
                <Property name="UserRolesCacheEnabled">true</Property>
                <Property name="ConnectionPoolingEnabled">true</Property>
                <Property name="LDAPConnectionTimeout">5000</Property>
                <Property name="ReadTimeout"/>
                <Property name="RetryAttempts"/>
                <Property name="ReplaceEscapeCharactersAtUserLogin">true</Property> 
            </UserStoreManager>
     </Realm>
    </UserManager> 
    1. 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, theconnectionURLshouldhavethe 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 LDAP) to connect to the LDAP/Active Directory:

      • You need set the ConnectionURL as shown below.

        Code Block
        languagexml
        <Property name="ConnectionURL">ldaps://10.100.1.100:636</Property>
      • For Active Directory, you need to import the certificate of Active Directory to the client-truststore.jks of the WSO2 product. For information on how to add certificates to the truststore and how keystores are configured and used in a system, see Using Asymmetric Encryption.

      • You also need to enable connection pooling for LDAPS connections at the time of starting your server, which will enhance server performance.

    2. 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>
    3. 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> 
    4. 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>
    5. Set the ReadGroups property to 'true', if it should be allowed to read roles from this user store. When this property is 'true', you must also specify values for the GroupSearchBase, GroupSearchFilter and GroupNameAttribute properties. If the ReadGroups property is set to 'false', only Users can be read from the user store. You can set the configuration to read roles from the user store by reading the user/role mapping based on a membership (user list) or backlink attribute as shown below.

      To read the user/role mapping based on a membership (This is used by the ApacheDirectory server and OpenLDAP)

      • 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 thefollowingcodesnipetinsteadofthe the following code snippet 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> 
    6. 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.

    7. In WSO2 products based on Carbon 4.4.x, you can set the LDAPConnectionTimeout property: If the connection to the LDAP is inactive for the length of time (in milliseconds) specified by this property, the connection will be terminated.

Anchor
Updating the system administrator
Updating the system administrator
Step 2: Updating the system administrator

...