Wednesday, November 6, 2013

How to connect a JDBC user store as a secondary user store for WSO2 IS 4.5.0

Hi All,

Today lets talk about how to connect WSO2 Identity Server to a JDBC user store to be used as a secondary user store.

Environment is : 

WSO2 IS 4.5.0
Ubuntu
MySQL

You need to have MySQL server installed. Download WSO2 Identity Server from here and MySql jdbc driver from here. Extract the IS server into a local folder and extract jdbc driver .zip as well.

1) First type the following command for root user access.
mysql -u root -p

Note:- You have to have your domain registered in the hosts file. In this scenario we are using localhost.

2) Then you can create a user for your new database.
CREATE USER umesha@localhost IDENTIFIED BY 'umesha';

3) Then create a new database
create database userStoreTest;

4) Then grant all access to the new user for that database
grant all on userStoreTest.* TO umesha@localhost identified by "umesha";

5) Exit from root user 
exit;

6) Go to [IS HOME] /wso2is-4.5.0/dbscripts$ and start MySql with newly created user
mysql -u umesha -p  and enter the password

7)  Use the newly created database
use userStoreTest;

8) Run the mysql database script provided by the WSO2 IS 4.5.0 to created the necessary tables for the storage of IS user information
source ./mysql.sql

9) Copy the jdbc driver .jar to <IS HOME>/repository/components/lib

10) Start the Identity Server with sh wso2server.sh and login to the management console by admin and admin as username and password respectively

11) Go to Configure/ User Store Management/ Add Secondary User Store

12) Fill as follows:

1. give a domain name
2.  driverName : com.mysql.jdbc.Driver
3. give the database url, username and password

(please click on the image to maximize ;) )



Click on add and the userstore will be saved. You can create users and roles for the IS using this secondary user store.

Thanks :)







No comments:

Post a Comment