...
So the user-mgt.xml file must contain details for two database connections. The connection details mentioned earlier is used by the Authorization manager. If we specify another set of database connection details inside UserStoreManager, it will read/write users to that database. Step by step guidelines for connecting to an external JDBC user store in read-only mode is given below.
Step 1 : Backup Back-up the <carbon-home>/repository/conf/user-mgt.xml file. A sample file for JDBC user store (user-mgt-jdbc.xml) is available in <carbon-home>/repository/conf directory . Download the relevant file and save it as <carbon-home><IS_HOME>/repository/conf/user-mgt.xml. Note Uncomment the following section in your file if it is commented out.
Code Block |
---|
<UserStoreManager class="org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager"> |
Step 2 : Find a valid user that resides in the RDBMS. For example, say a valid username is "AdminSOA". Update the Admin user section of your ldap configuration as follows. You don't have to update the password element; leave it as it is.
Code Block |
---|
<AdminUser> <UserName>AdminSOA</UserName> <Password>XXXXXX</Password> </AdminUser> |
Step 3 : In user-mgt.xml file, add passwordHashMethod property within the JDBCUserStoreManager. For example,
Code Block | ||
---|---|---|
| ||
<UserStoreManager class="org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager">
<Property name="passwordHashMethod">SHA</Property>
...
</UserStoreManager> |
The passwordHashMethod property specifies how the password should be stored, and usually has the values:
- SHA - Uses SHA digest method.
- MD5 - Uses MD 5 digest method.
- PLAIN_TEXT - Plain text passwords.
- In addition, it also supports all digest methods in http://docs.oracle.com/javase/6/docs/api/java/security/MessageDigest.html.
Step 4 : Update connection details inside <UserStoreManager> class.
Step 5 : In user-mgt.xml file, under realm configuration, set the value of MultiTenantRealmConfigBuilder property to org.wso2.carbon.user.core.config.multitenancy.SimpleRealmConfigBuilder. For example,
Code Block | ||
---|---|---|
| ||
<Property name="MultiTenantRealmConfigBuilder">org.wso2.carbon.user.core.config.multitenancy.SimpleRealmConfigBuilder</Property> |
Step 6 : Add the JDBC driver to the classpath by dropping the jar to <carbon-home>/repository/components/lib directory.
Step 47 : Update the connection details inside the <UserStoreManager> class.Step 5 : Edit the SQLs as you desire Edit the SQLs in user-mgt.xml file according to your requirements, and start the server.
Excerpt | ||
---|---|---|
| ||
Information on managing external user stores in WSO2 Carbon. |
...