This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The  <PRODUCT_HOME>/repository/conf/user-mgt.xml file has commented-out configurations for an external Active Directory user store.

Before you begin

  • To read and write to an Active Directory user store, set the WriteGroups property to true instead of false.
  • Use the following class for Active Directory.

    <UserStoreManager class="org.wso2.carbon.user.core.ldap.ActiveDirectoryUserStoreManager">

 

  1. Enable the <ActiveDirectoryUserStoreManager> in the <PRODUCT_HOME>/repository/conf/user-mgt.xml file by uncommenting the code. When it is enabled, the user manager reads/writes into the Active Directory user store. 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 follows. Change the values according to your requirements.

    <UserStoreManager class="org.wso2.carbon.user.core.ldap.ActiveDirectoryUserStoreManager">
                <Property name="TenantManager">org.wso2.carbon.user.core.tenant.CommonHybridLDAPTenantManager</Property>
                <Property name="defaultRealmName">WSO2.ORG</Property>
                <Property name="Disabled">false</Property>                                   
                <Property name="kdcEnabled">false</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="PasswordHashMethod">PLAIN_TEXT</Property>
                <Property name="UserSearchBase">CN=Users,DC=WSO2,DC=Com</Property>
                <Property name="UserEntryObjectClass">user</Property>
                <Property name="UserNameAttribute">cn</Property>
                <Property name="isADLDSRole">false</Property>
    	    	<Property name="userAccountControl">512</Property>
                <Property name="UserNameListFilter">(objectClass=user)</Property>
    	    	<Property name="UserNameSearchFilter">(&amp;(objectClass=user)(cn=?))</Property>
                <Property name="UsernameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
                <Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property>
                <Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
    	    	<Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property>
                <Property name="RolenameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
    	    	<Property name="ReadGroups">true</Property>
    	    	<Property name="WriteGroups">true</Property>
    	    	<Property name="EmptyRolesAllowed">true</Property>
                <Property name="GroupSearchBase">CN=Users,DC=WSO2,DC=Com</Property>
    	    	<Property name="GroupEntryObjectClass">group</Property>
                <Property name="GroupNameAttribute">cn</Property>
                <Property name="SharedGroupNameAttribute">cn</Property>
                <Property name="SharedGroupSearchBase">ou=SharedGroups,dc=wso2,dc=org</Property>
                <Property name="SharedGroupEntryObjectClass">groups</Property>
                <Property name="SharedTenantNameListFilter">(object=organizationalUnit)</Property>
                <Property name="SharedTenantNameAttribute">ou</Property>
                <Property name="SharedTenantObjectClass">organizationalUnit</Property>
                <Property name="MembershipAttribute">member</Property>
                <Property name="GroupNameListFilter">(objectcategory=group)</Property>
    	    	<Property name="GroupNameSearchFilter">(&amp;(objectClass=group)(cn=?))</Property>
                <Property name="UserRolesCacheEnabled">true</Property>
                <Property name="Referral">follow</Property>
    	    	<Property name="BackLinksEnabled">true</Property>
                <Property name="MaxRoleNameListLength">100</Property>
                <Property name="MaxUserNameListLength">100</Property>
                <Property name="SCIMEnabled">false</Property>
    </UserStoreManager>

    When working with Active Directory it is best to enable the GetAllRolesOfUserEnabled property in the AuthorizationManager as follows.

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

    While 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 permissions stats.

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

    <Property name="UserNameAttribute">sAMAccountName</Property>
  4. The following code snippet represents reading roles based on a backlink attribute. This is used by the Active Directory.

    <Property name="ReadLDAPGroups">true</Property>
    <Property name="GroupSearchBase">cn=users,dc=wso2,dc=lk</Property>
    <Property name="GroupSearchFilter">(objectcategory=group)</Property>
    <Property name="GroupNameAttribute">cn</Property>
    <Property name="MemberOfAttribute">memberOf</Property>
    
  5. 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.

  • No labels