Pages

Showing posts with label WSO2. Show all posts
Showing posts with label WSO2. Show all posts

Wednesday, 21 January 2015

Connect the WSO2 Product to an External LDAP User Store


Here i would like to share that how to connect WSO2 product with LDAP user store ,I explaining with the API manager


STEP 1 : Logging to https://localhost:9443/carbon
STEP 2: Select the user store adding option as follows


STEP 3 : fill the  UI with connection details (LDAP Configuration)



Sample XML file of above configuration as follows

<?xml version="1.0" encoding="UTF-8"?><UserStoreManager     class="org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager">
  <Property name="ConnectionName">cn=admin,dc=ds,dc=sample,dc=com</Property>
  <Property name="ConnectionURL">ldap://192.168.1.1:389</Property>
  <Property name="ConnectionPassword">XXXX</Property>
  <Property name="UserSearchBase">ou=People,dc=prime,dc=ds,dc=sample,dc=com</Property>
  <Property name="Disabled">false</Property>
  <Property name="UserNameListFilter">(objectClass=inetOrgPerson)</Property>
  <Property name="UserNameAttribute">uid</Property>
  <Property name="UserNameSearchFilter">(&amp;(objectClass=inetOrgPerson)(uid=?))</Property>
  <Property name="UserEntryObjectClass">inetOrgPerson</Property>
  <Property name="GroupEntryObjectClass">organizationalUnit</Property>
  <Property name="ReadGroups">false</Property>
  <Property name="GroupSearchBase">ou=People,dc=prime,dc=ds,dc=sample,dc=com</Property>
  <Property name="GroupNameAttribute">uid</Property>
  <Property name="GroupNameListFilter">(objectClass=groupOfNames)</Property>
  <Property name="MembershipAttribute">member</Property>
  <Property name="GroupNameSearchFilter">(&amp;(objectClass=groupOfNames)(ou=?))</Property>
  <Property name="MaxUserNameListLength">100</Property>
  <Property name="MaxRoleNameListLength">100</Property>
  <Property name="UserRolesCacheEnabled">true</Property>
  <Property name="SCIMEnabled">false</Property>
  <Property name="PasswordHashMethod">SHA</Property>
  <Property name="UserDNPattern">uid={0},ou=People,dc=prime,dc=ds,dc=sample,dc=com</Property>
  <Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
  <Property name="UserNameJavaScriptRegEx">^[\S]{3,30}$</Property>
  <Property name="UserNameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
  <Property name="RoleNameJavaScriptRegEx">^[\S]{3,30}$</Property>
  <Property name="RoleNameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
  <Property name="WriteGroups">true</Property>
  <Property name="EmptyRolesAllowed">true</Property>
  <Property name="DomainName">ldap</Property>
  <Property name="Description">ldap
        </Property>
</UserStoreManager>

Now API manger connected with LDAP  user store

Note :

Please ensure that you  filled the   'User DN Pattern ' field


Tuesday, 17 June 2014

Read Path Param in wso2 ESB 4.8.1

Read Path Param in wso2 ESB 4.8.1

We can read 'path' parameter in WSO2 ESB. To do so , we can use "uri-template" attribute  of  <resource> tag.

Suppose  we need  to read parameter from an API like "example.com/api/getStatus/{some category}/{some id}.json", So  we should  configure API in ESB as follows :

STEP 1:

Give the first static part of the URL as the 'context' of <api> tag

Example 

<api xmlns="http://ws.apache.org/ns/synapse" name="sample-API" context="/api/getStatus">

STEP 2:

Give the remains part of the URL as the  'uri-template' <resource> tag but dynamic value may write  inside {} brackets.

Example

 <resource methods="GET" uri-template="/{category}/{id}.json">

 How to read Parameter

We can read url path param by using the 'expression' of <property> tag. In <property> tag ,the variable name should same as  mentioned inside {} brackets in <resource> tag.

 Example

<property name="uri.var.category" expression="getproperty('uri.var.category')"></property>
  <property name="uri.var.id" expression="get-property('uri.var.id')"></property>

Wednesday, 21 May 2014

Set Json payload in WSO2 ESB 4.8 and 4.8.1


Here i would like to share that how to set dynamic json payload in WSO2 ESB 4.8 and 4.8.1

We can use  'json' media-type property of 'payloadFactory' mediator to do that.

SAMPLE API 

In this API  accepts post request including user and pwd body parameters

 <api xmlns="http://ws.apache.org/ns/synapse" name="test-API" context="/api/test.json">
   <resource methods="POST">
      <inSequence>
         <payloadFactory media-type="json">
            <format>
{"username":"$1","pwd":"$2"}
</format>
            <args>
               <arg evaluator="json" expression="$.user"></arg>
               <arg evaluator="json" expression="$.pwd"></arg>            
            </args>
         </payloadFactory>
         <log level="full"></log>
         <send>
            <endpoint>
               <http method="POST" uri-template="http://example.com/test/enpoint"></http>
            </endpoint>
         </send>
      </inSequence>
   </resource>
</api>

Tuesday, 25 February 2014

Install multiple WSO2 Products




 Bellow  describes the default ports that are used for each WSO2 product when the port offset is 0.

  • 9443 - HTTPS (the default URL of the management console is              https://localhost:9443/carbon)
  • 9763 - HTTP servlet transport
For multiple product installation you should change the offset value

How To Change Offset Value

 Edit the default offset configuration defined in the carbon.xml  file located at  $CARBON_HOME/repository/conf/carbon.xml.

 If you change value as 1[ <offset>1<offset>] , then the default URL of the management console is https://localhost:9444/carbon

Thursday, 20 February 2014

Setting up WSO2 Carbon Products with MySQL


 Downlaod and install WSO2 Product  and Mysql


 Setup Configuration Files

1. Edit the default database configuration defined in the  master-datasources.xml  file located at  $CARBON_HOME/repository/conf/datasources  directory as below. Both the database configurations in  registry.xml  and  user-mgt.xml  refer this data source.

 <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://localhost:3306/wso2</url>
               <username>root1</username>
               <password>root1</password>
               <driverClassName>com.mysql.jdbc.Driver</driverClassName>
               <maxActive>80</maxActive>
               <maxWait>60000</maxWait>
               <minIdle>5</minIdle>
               <testOnBorrow>true</testOnBorrow>
               <validationQuery>SELECT 1</validationQuery>
               <validationInterval>30000</validationInterval>
           </configuration>
       </definition>
</datasource>


The database configuration options

url - The URL of the database.
username  - The name of the database user.
password - The password of the database user.
driverClassName  - The class name of the database driver.
maxActive - The maximum number of active connections that can be allocated from this pool at the same time or negative for no limit.
maxWait - The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception or <= 0 to wait indefinitely.
minIdle - The minimum number of active connections that can remain idle in the pool without extra ones being created or 0 to create none.

Create Database
(Start WSO2 and Automatic Database Creation)

 When you start the server for the first time, use the -Dsetup option. It will create all the tables in the given MySQL database.

For Linux:

wso2server.sh -Dsetup


For Windows:

wso2server.bat -Dsetup