Wednesday, June 2, 2010

How to specify system-properties when WSO2 ESB started if deployed on top of an application server

When starting the WSO2 ESB server, we can specify different system-properties such as -DuseSynapseXML, -Dsetup, -Dcarbon.registry.root. But if you have deployed your WSO2 ESB instance on top of an Application server like JBoss or Tomcat, you will wonder how you can specify such options. To make this possible, all you have to do is follow the below steps.

Step 1 - Open a terminal window

Step 2 - Set the system-property which you want to set as a JAVA_OPTS variable
E.g.:- For linux - export JAVA_OPTS="-DuseSynapseXML"
For Windows - set JAVA_OPTS="-DuseSynapseXML"

Step 3 - Now start the Application server the usual way and you will notice that WSO2 ESB is started with the option which you set.
E.g.:- If you specified the system-property -DuseSynapseXML, notice that the server loads the synapse.xml located at the file system and not from the registry

Tuesday, June 1, 2010

Signing in to WSO2 ESB 3.0.x using users in an LDap User Store

Assume that you have a list of users in an LDap server and you need to access WSO2 ESB using one of the users in the LDap user store and not with the default admin username and password. All you have to do is do a simple change in a configuration file of your ESB instance. I have listed the steps which one needs to follow.

Pre-Requisites

An LDAP server should be up and running with users.

Step 1

Download the latest WSO2 ESB version from here and extract to a location of your choice.
(E.g.:- /opt/products/wso2esb-3.0.0). From this point onwards I will refer to this location as ESB_HOME.

Step 2

Next go to ESB_HOME/repository/conf and open up the user-mgt.xml.

a) First notice that the section with the tag <userstoremanager> is uncommented where the class is org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager. Comment out this section.
Then locate the section with the tag <userstoremanager> where the class is specified as org.wso2.carbon.user.core.ldap.LDAPUserStoreManager and uncomment it. This section will contain the configuration which is used to our LDap user store.


<UserStoreManager class="org.wso2.carbon.user.core.ldap.LDAPUserStoreManager">
<property name="ConnectionURL">ldap://localhost:10389</property>
<property name="ConnectionName">uid=admin,ou=system</property>
<property name="ConnectionPassword">secret</property>
<property name="UserSearchBase">ou=system</property>
<property name="UserNameListFilter">(objectClass=person)</property>
<property name="UserNameAttribute">uid</property>
<property name="ReadLDAPGroups">false</property>
<property name="GroupSearchBase">ou=system</property>
<property name="GroupSearchFilter">(objectClass=groupOfNames)</property>
<property name="GroupNameAttribute">cn</property>
<property name="MembershipAttribute">member</property>
</userstoremanager>


Note that you have to remember the ConnectionURL, ConnectionName and the ConnectionPassword values of your LDAP user store while setting it up.

b) Next go to the top of the user-mgt.xml and change the <username> and <password> tag values to a user which you already have in you LDAP user store.

c) Also change the <readonly> property value to true as shown below

<usermanager>
<realm>
<configuration>
<adminrole>admin</adminrole>
<adminuser>
<username>evanthika</username>
<password>evanthika</password>
</adminuser>
<everyonerolename>everyone</everyonerolename>
<readonly>true</readonly>
:
:
:
</realm>
</usermanager>



Step 3

Now you are all set to go. Go to the ESB_HOME/bin folder and start the WSO2 ESB server by giving the command

$ sh ./wso2server.sh

Step 4

Once the server is started access the Management Console through the URL https://localhost:9443/carbon and you should be able to login using the username/password which you specified in the user-mgt.xml file (evanthika/evanthika).