Friday, December 19, 2014

Secure Web Services with WSO2 ESB as Integration Layer

WSO2 ESB supports securing unsecured web services. In this post I'm going to explain how you can secure a web service with WSO2 ESB, using it as an integration layer. 

You may have heard of proxy services. A proxy service is a virtual service hosted within an ESB. Simply a proxy service wraps a back-end web service hosted in an application server.  A proxy service receives messages that have been sent to a specific endpoint (back-end service) defined in the proxy service configuration. Before forwarding the messages to the relevant endpoint the proxy service can process them if needed, using mediators.

These back-end services may no be secured always. In such a case those unsecured services can be made secured by using the ESB as integration layer. To do that what we need to do is creating a secure proxy service with WS-Security enabled with a specified security policy. 

Here are the simple steps to follow to secure a web service.
  1. Open the ESB Management Console.
  2. Create a Proxy Service by clicking on the Services -> Add -> Proxy Service ->Pass Through Proxy in the Main tab. (Here I've selected Pass Through Proxy since I just need to forward messages to the endpoint without performing any processing on them)
  3.  Give a name for the Proxy Service and specify the target endpoint. Here I've given the web service URL which is hosted within the Axis2 server.


  4.  Then you will be redirected to the List of Services.
  5.  You will see the proxy service is shown as 'Unsecured'. Click on 'Unsecured'.


  6. You will be prompted to Enable Security. Select Yes. Then select the UsernameToken as the Basic Scenario.
  7. Click Next. Select user group and Finish.
  8. Now the proxy service is security enabled. You can see the endpoint starting with https:// service dashboard of the proxy service.

Now let's see how to access this web service using a secure client.

References : 

No comments: