This blog describes how to configure WSO2IS with JDBC user store, for this I'm using MySQL database.
Pre-requisites:
Download and extract the wso2is-4.1.0.zip product
Download and installed the MySQL 5.1 (http://aparnaank.blogspot.com/2012/10/how-to-configure-mysql-51-on-redhat.html)
1. First create a database in mysql ex: create database isdb;
2. Now will start to configure the WSO2IS. There are several configurations have to changed. WSO2IS home directory is referred as $IS_HOME.
Go to $IS_HOME/repository/conf/datasources directory location and open the master-datasources.xml file. This file has the database configurations and edit the master-datasources.xml file(change the bold lines according to your evn) as follows.
Database configuration is completed and will move to other configurations.
3. Go to the $IS_HOME/repository/conf/ directory location and open the ldap.xml. Edit the file as follows.
From above configuration we are disabling the embedded ldap that comes with WSO2IS pack.
4. Now open the user-mgt.xml file which locate the same directory and set the "MultiTenantRealmConfigBuilder" to "org.wso2.carbon.user.core.config.multitenancy.SimpleRealmConfigBuilder"
ex:
Uncomment following section which enable the jdbc user store configuration.
5. Then edit the tenant-mgt.xml file that located in the same place.
Comment the following section:
Uncomment following section:
Now configurations are completed and before starting the server copy the mysql driver to following location
$IS_HOME/repository/components/lib
Start the WSO2IS server from the $IS_HOME with following command
./bin/wso2server.sh -Dsetup (when you give the -Dsetup option it will create all the necessary tables structure in the mysql database)
You can login to the server using default credentials username/password - admin/admin
Then you can create/delete/edit any number of users/roles
Pre-requisites:
Download and extract the wso2is-4.1.0.zip product
Download and installed the MySQL 5.1 (http://aparnaank.blogspot.com/2012/10/how-to-configure-mysql-51-on-redhat.html)
1. First create a database in mysql ex: create database isdb;
2. Now will start to configure the WSO2IS. There are several configurations have to changed. WSO2IS home directory is referred as $IS_HOME.
Go to $IS_HOME/repository/conf/datasources directory location and open the master-datasources.xml file. This file has the database configurations and edit the master-datasources.xml file(change the bold lines according to your evn) as follows.
<datasource> <name>WSO2_CARBON_DB</name> <description>The datasource used for registry and user manager</description> <jndiConfig> <name>jdbc/WSO2CarbonDB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://10.200.3.106:3306/isdb</url> <username>root</username> <password>root</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource>
Database configuration is completed and will move to other configurations.
3. Go to the $IS_HOME/repository/conf/ directory location and open the ldap.xml. Edit the file as follows.
<EmbeddedLDAP> <Property name="enable">false</Property>
From above configuration we are disabling the embedded ldap that comes with WSO2IS pack.
4. Now open the user-mgt.xml file which locate the same directory and set the "MultiTenantRealmConfigBuilder" to "org.wso2.carbon.user.core.config.multitenancy.SimpleRealmConfigBuilder"
ex:
<Property name="MultiTenantRealmConfigBuilder">org.wso2.carbon.user.core.config.multitenancy.SimpleRealmConfigBuilder</Property>
Uncomment following section which enable the jdbc user store configuration.
<UserStoreManager class="org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager"> <Property name="ReadOnly">false</Property> <Property name="MaxUserNameListLength">100</Property> <Property name="IsEmailUserName">false</Property> <Property name="DomainCalculation">default</Property> <Property name="PasswordDigest">SHA-256</Property> <Property name="StoreSaltedPassword">true</Property> <Property name="UserNameUniqueAcrossTenants">false</Property> <Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property> <Property name="PasswordJavaScriptRegEx">^[\\S]{5,30}$</Property> <Property name="UsernameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\<>,\'\"]{3,30}$</Property> <Property name="UsernameJavaScriptRegEx">^[\\S]{3,30}$</Property> <Property name="RolenameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\<>,\'\"]{3,30}$</Property> <Property name="RolenameJavaScriptRegEx">^[\\S]{3,30}$</Property> <Property name="UserRolesCacheEnabled">true</Property> <Property name="maxFailedLoginAttempt">0</Property> </UserStoreManager>
5. Then edit the tenant-mgt.xml file that located in the same place.
Comment the following section:
<TenantManager class="org.wso2.carbon.user.core.tenant.CommonHybridLDAPTenantManager"> <Property name="RootPartition">dc=wso2,dc=org</Property> <Property name="OrganizationalObjectClass">organizationalUnit</Property> <Property name="OrganizationalAttribute">ou</Property> <Property name="OrganizationalSubContextObjectClass">organizationalUnit</Property> <Property name="OrganizationalSubContextAttribute">ou</Property> </TenantManager>
Uncomment following section:
<TenantManager class="org.wso2.carbon.user.core.tenant.JDBCTenantManager"> </TenantManager>
Now configurations are completed and before starting the server copy the mysql driver to following location
$IS_HOME/repository/components/lib
Start the WSO2IS server from the $IS_HOME with following command
./bin/wso2server.sh -Dsetup (when you give the -Dsetup option it will create all the necessary tables structure in the mysql database)
You can login to the server using default credentials username/password - admin/admin
Then you can create/delete/edit any number of users/roles
No comments:
Post a Comment