Configuring the Authorization Manager
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 documentation explains how to set up a repository for storing authorization information (role-based permissions) and how to change the relevant configurations.
According to the default configuration in WSO2 products, the Users, Roles and Permissions are stored in the same repository (i.e., the default, embedded H2 database). However, you can change this configuration in such a way that the Users and Roles are stored in one repository (User Store) and the Permissions are stored in a separate repository. A user store can be a typical RDBMS, an LDAP or an external Active Directory. See the related topics for information on how user stores are configured. The repository that stores Permissions should always be an RDBMS. The Authorization Manager configuration in the user-mgt.xml file (stored in the Follow the instructions given below to set up and configure the Authorization Manager. By default, the embedded H2 database is used for storing permissions. You can change this as follows: Refer the related topics for detailed information on setting up databases and configuring datasources. Once you have set up a new RDBMS and configured the datasource, the Update the datasource information using the Property Name Description This is the jndi name of the datasource that is used for referring to the datasource. In the following example, the jndi name of the default datasource defined in the You can add more optional configurations using the Property Name Description It is recommended to set this property to 'true' so that object connections will be validated before being borrowed from the JDBC pool. For this property to be effective, the Shown below is how the Authorization Manager is enabled in the user-mgt.xml file. It is recommended to enable the 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. By default, the rules linked to a permission (role name, action, resource) are not case sensitive. If you want to make them case sensitive, enable the following property:<PRODUCT_HOME>/repository/conf/
directory) connects the system to this RDBMS.Step 1: Setting up the repository
master-datasource.xml
file (stored in the <PRODUCT_HOME>/repository/conf/datasources/
directory) with the relevant information. <PRODUCT_HOME>/repository/conf/datasources/
directory.Step 2: Updating the user realm configurations
user-mgt.xml
file (user realm configuration) should be updated as explained below.Setting up the database connection
<Property>
element under <Configuration>
. Given below are the properties that are set by default.Mandatory/Optional dataSource
<PRODUCT_HOME>/repository/conf/datasources/master-datasources.xml
file is linked from the user-mgt.xml
file.Mandatory isCascadeDeleteEnabled
This property is set to 'true' by default, which enables cascade delete for the UM_USER_PERMISSION and UM_ROLE_PERMISSION tables when a permission gets deleted from the UM_PERMISSION table. That is, if a record in the parent table is deleted the corresponding records in the child table will be automatically deleted. Mandatory <Property>
element:Mandatory/Optional testOnBorrow
validationQuery
parameter in the <PRODUCT_HOME>/repository/conf/datasources/master-datasources.xml
file should be a non-string value. This setting will avoid connection failures. See the section on performance tuning of WSO2 products for more information.Optional Configuring the Authorization Manager
<AuthorizationManager class="org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager">
<Property name="AdminRoleManagementPermissions">/permission</Property>
<Property name="AuthorizationCacheEnabled">true</Property>
<Property name="GetAllRolesOfUserEnabled">false</Property>
</AuthorizationManager>
org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager
class enables the Authorization Manager for your product.AdminRoleManagementPermissions
property sets the registry path where the authorization information (role-based permissions) are stored. Note that this links to the repository that you defined in Step 1.GetAllRolesOfUserEnabled
property in the AuthorizationManager
as follows:<Property name="GetAllRolesOfUserEnabled">true</Property>
<Property name="CaseSensitiveAuthorizationRules">true</Property>
Related Topics
- Configuring User Stores: This topic explains how the repositories for storing information about Users and Roles are configured.
- /wiki/spaces/SM100/pages/14221351: This section explains how you can set up a new RDBMS and configure it for your system.
- /wiki/spaces/SM100/pages/14222728: This section explains the purpose of defining datasources and how they are configured for a product.