This documentation is for WSO2 Open Banking version 1.5.0. View documentation for the latest release.

Versions Compared

Key

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

...

Info
titleBefore you begin
  • If you create the user-mgt.xml file yourself, be sure to save it in the <PRODUCT<WSO2_OB_KM_HOME>/repository/conf directory and <WSO2_OB_APIM_HOME>/repository/conf directories.
  • The class attribute for an external AD is <UserStoreManager class="org.wso2.carbon.user.core.ldap.ActiveDirectoryUserStoreManager">.
  1. Enable the ActiveDirectoryUserStoreManager class in the <PRODUCT<WSO2_OB_KM_HOME>/repository/conf/user-mgt.xml file  and <WSO2_OB_APIM_HOME>/repository/conf/user-mgt.xml files by uncommenting the code. When it is enabled, the user manager reads/writes into the Active Directory user store. 

    Note

    Note that these configurations already exist in the user-mgt.xml file so you only need to uncomment them and make the appropriate adjustments. Also ensure that you comment out the configurations for other user stores which you are not using.

  2. The default configuration for the external read/write user store in the user-mgt.xml file is as given below. Change the values according to your requirement. For more information on each of the properties used in the user-mgt.xml file for configuring the primary user store, see Properties of User Stores.

    Code Block
    languagehtml/xml
    <UserStoreManager class="org.wso2.carbon.user.core.ldap.ActiveDirectoryUserStoreManager">
                <Property name="TenantManager">org.wso2.carbon.user.core.tenant.CommonHybridLDAPTenantManager</Property>
                <Property name="ConnectionURL">ldaps://10.100.1.100:636</Property> 
                <Property name="ConnectionName">CN=admin,CN=Users,DC=WSO2,DC=Com</Property>
                <Property name="ConnectionPassword">A1b2c3d4</Property>
                <Property name="AnonymousBind">false</Property>
                <Property name="UserSearchBase">CN=Users,DC=WSO2,DC=Com</Property>
                <Property name="UserEntryObjectClass">user</Property>
                <Property name="UserNameAttribute">cn</Property>
                <Property name="UserNameSearchFilter">(&amp;(objectClass=user)(cn=?))</Property>
                <Property name="UserNameListFilter">(objectClass=user)</Property>
                <Property name="DisplayNameAttribute"/>
                <Property name="ReadGroups">true</Property>
                <Property name="WriteGroups">true</Property>
                <Property name="GroupSearchBase">CN=Users,DC=WSO2,DC=Com</Property>
                <Property name="GroupEntryObjectClass">group</Property>
                <Property name="GroupNameAttribute">cn</Property>
                <Property name="GroupNameSearchFilter">(&amp;(objectClass=group)(cn=?))</Property>
                <Property name="GroupNameListFilter">(objectcategory=group)</Property>
                <Property name="MembershipAttribute">member</Property>
                <Property name="MemberOfAttribute">memberOf</Property>
                <Property name="BackLinksEnabled">true</Property>
                <Property name="Referral">follow</Property>
                <Property name="UsernameJavaRegEx">[a-zA-Z0-9._\-|/]{3,30}$</Property>
                <Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property>
                <Property name="UsernameJavaRegExViolationErrorMsg">Username pattern policy violated</Property>
                <Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
                <Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
                <Property name="PasswordJavaRegExViolationErrorMsg">Password length should be within 5 to 30 characters</Property>
                <Property name="RolenameJavaRegEx">[a-zA-Z0-9._\-|/]{3,30}$</Property>
                <Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property>
                <Property name="SCIMEnabled">false</Property>
                <Property name="IsBulkImportSupported">true</Property>
                <Property name="EmptyRolesAllowed">true</Property>
                <Property name="PasswordHashMethod">PLAIN_TEXT</Property>
                <Property name="MultiAttributeSeparator">,</Property>
                <Property name="isADLDSRole">false</Property>
                <Property name="userAccountControl">512</Property>
                <Property name="MaxUserNameListLength">100</Property>     
                <Property name="MaxRoleNameListLength">100</Property>                     
                <Property name="kdcEnabled">false</Property>
                <Property name="defaultRealmName">WSO2.ORG</Property>
                <Property name="UserRolesCacheEnabled">true</Property>
                <Property name="ConnectionPoolingEnabled">false</Property>
                <Property name="LDAPConnectionTimeout">5000</Property>
                <Property name="ReadTimeout"/>
                <Property name="RetryAttempts"/>
    </UserStoreManager>
    Note

    When working with Active Directory;

    • It is best to enable the GetAllRolesOfUserEnabled property in the AuthorizationManager as follows. See the documentation on configuring the Authorization Manager for more information.

      Code Block
      languagexml
      <AuthorizationManager class="org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager">
      	<Property name="AdminRoleManagementPermissions">/permission</Property>
      	<Property name="AuthorizationCacheEnabled">true</Property>
      	<Property name="GetAllRolesOfUserEnabled">true</Property>
      </AuthorizationManager>

      Although using the user store manager does not depend on this property, you must consider enabling this if there are any performance issues in your production environment. Enabling this property affects the performance when the user logs in. This depends on the users, roles and permission stats.
       

    • If you are using ldaps (secured LDAP) to connect to the Active Directory as shown in the example below, 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.

      Code Block
      languagexml
      <Property name="ConnectionURL">ldaps://10.100.1.100:636</Property>
    • You also need to enable connection pooling for LDAPS connections at the time of starting your server, which will enhance server performance.

  3. 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.

  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. 

    Code Block
    languagehtml/xml
    <Property name="UserNameAttribute">sAMAccountName</Property>
  5. 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.

  6. 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 GroupSearchBaseGroupSearchFilter 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 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> 

...