Skip to main content

Posts

Showing posts from February, 2016

Test SOAP Client and REST Service in WSO2 ESB

Wso2 ESB can convert anything to anything. Today I'm going to explain the below scenario. Scenario :-  1. Soap client send a request to ESB with soap header. 2. ESB remove soap header and invoke the REST service which only accept XML format. 3. REST service generate a response in xml format 4. ESB adding soap headers to response and send back to SOAP client. As an example REST service, I'm going to use  jaxrs_basic  service in WSO2 Application server. Download wso2 application server from this link Step 1 :-            Change the offset value in carbon.xml file which is located in <AS_HOME>/repository/conf directory.                 If you started WSO2 ESB in offset "0" set offset in application server as "1"   <Offset>1</Offset>                Start wso2 application server Step 2 :-            Start ESB (make sure you do not have same offset value in both ESB and Application Server)            Go to the man

CURL commands to get access token from WSO2 Identity Server

WSO2 Identity server supports all grant types those are defined in oAuth2 core specification Four grant types: Authorization Code Grant Implicit Grant Resource Owner Password Credentials Grant (password) Client Credentials Grant We cannot use curl command directly to get an access token for Authorization code grant type and Implicit grant type. I'm going through other two grant types one by one and provide the curl command to get access token. 3. Get access token using password grant type curl -k -d "grant_type=password&username=admin&password=admin" -H "Authorization: Basic ME5fbXdWRXpTVnhfalJIbDV2cmc4RHIycHZBYTp0RmZjcHVFRFM5V1d2eFFEc1ZCd0tWVGd0dE1h, Content-Type: application/x-www-form-urlencoded" https://localhost:9443/oauth2/token ME5fbXdWRXpTVnhfalJIbDV2cmc4RHIycHZBYTp0RmZjcHVFRFM5V1d2eFFEc1ZCd0tWVGd is the encoded value of 0N_mwVEzSVx_jRHl5vrg8Dr2pvAa:tFfcpuEDS9WWvxQDsVBwKVTgttMa (<client_id>:<client_secret>). these

CURL commands to get access token from WSO2 Identity Server

WSO2 Identity server supports all grant types those are defined in oAuth2 core specification Four grant types: Authorization Code Grant Implicit Grant Resource Owner Password Credentials Grant (password) Client Credentials Grant We cannot use curl command directly to get an access token for Authorization code grant type and Implicit grant type. I'm going through other two grant types one by one and provide the curl command to get access token. 3. Get access token using password grant type curl -k -d "grant_type=password&username=admin&password=admin" -H "Authorization: Basic ME5fbXdWRXpTVnhfalJIbDV2cmc4RHIycHZBYTp0RmZjcHVFRFM5V1d2eFFEc1ZCd0tWVGd0dE1h, Content-Type: application/x-www-form-urlencoded" https://localhost:9443/oauth2/token ME5fbXdWRXpTVnhfalJIbDV2cmc4RHIycHZBYTp0RmZjcHVFRFM5V1d2eFFEc1ZCd0tWVGd is the encoded value of 0N_mwVEzSVx_jRHl5vrg8Dr2pvAa:tFfcpuEDS9WWvxQDsVBwKVTgttMa (<client_id>:<client_secret>). these

Renew access token using refresh token in WSO2 Identity Server

When you are using same access token for some period, you may need to renew the old token due to expiration or security concerns. You can renew an access token using a refresh token, by a REST  call with below curl command. curl -k -d "grant_type=refresh_token&refresh_token=eaa3683b1cf78496b6c1e5b7ffc882&scope=PRODUCTION" -H "Authorization: Basic ME5fbXdWRXpTVnhfalJIbDV2cmc4RHIycHZBYTp0RmZjcHVFRFM5V1d2eFFEc1ZCd0tWVGd0dE1h, Content-Type: application/x-www-form-urlencoded" https://localhost:9443/oauth2/token eaa3683b1cf78496b6c1e5b7ffc882 is a refresh token. ME5fbXdWRXpTVnhfalJIbDV2cmc4RHIycHZBYTp0RmZjcHVFRFM5V1d2eFFEc1ZCd0tWVGd is the encoded value of <client_id>:<client_secret>. these value should be separated by colon(:). https://localhost:9443/oauth2/token is the token endpoint url. when you use above request, you may get this type of response {"token_type":"bearer","expires_in":3600,&

Configure PostgreSQL 9.3 with WSO2 Identity server 5.1.0

I'm going to show you configuration steps to use PostgresSQL with WSO2 Identity server 5.1.0. Step 1 :- install postgresql 9.3 using below command. When you are installing this, you may have to give special permissions for /var/lib/cache directory.  sudo apt-get update sudo apt-get install postgresql When you are giving permission, Do not use below command to give permission for /var/ directory. because it will override the super user and you may have to re install linux. sudo chmod 777 -R /var/lib/sudo/ Step 2 :- start postgresql server with below command sudo /etc/init.d/postgresql start download Create a database and the login role from a GUI using the  PGAdminIII tool . Start  PGAdminIII tool  using below command.  sudo ./postgresql-9.3.10-3-linux-x64.run Step 3 :-  Create a database 'gregdb' and add a new user Login Role('postgres', 'postgres') click OK Step 4 :- 

Special logout implementation in wso2 Identity server

No matter what ever protocol you used in wso2 identity server. You can use this log out request to logout from wso2 identity server. https://localhost:9443/commonauth?commonAuthLogout=true&type=type&sessionDataKey=1234567&commonAuthCallerPath=http://localhost:8080/PassiveSTSSampleApp&relyingParty=PassiveSTSSampleApp commonAuthLogout log out parameter. this parameter should be 'true' if you create a logout request sessionDataKey is any random value. commonAuthCallerPath is the redirection url relyingParty is registered SP application name which is registered in the WSO2IS You can directly talk to /commonauth without invoking other endpoint. So this can be used for any protocol. For an example I'm going to send a log out request to an application which used passive-sts. Step 1 :- Please create a setup following this blog[1]. Step 2 :-  log in to the application. Step 3 :- Use below url to log out from the application. https://lo

Test WSO2 Identity Server's Passive STS

This blog explained the way to test the passive sts in wso2 identity server. I'm using wso2 identity server 5.0.0 with service pack1. Step 1 :- Checkout this sample[1] and build it. sudo svn checkout http://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/products/is/5.0.0/modules/samples/passive-sts/ passive-sts mvn clean install Step 2 :- Deploy PassiveSTSSampleApp.war file which is created in /home/madura/Documents/issues/UNISUPERDEV-25/passive-sts/passive-sts-client/PassiveSTSSampleApp/target directory. You can use external tomcat server for deployment. If not you can use the tomcat server located in IS Step 3 :-  IDP configurations  Click ‘Add’ under ‘Service Providers’ in the ‘Main’ tab. Specify any name as the service provider name. We have used  passivests  here. Select the 'WS-Trust Security Token Service Configuration',  click configure and add new trusted service as below. Under ‘Inbound Aut