Wednesday, August 11, 2010

Using WS-Security with RiftSaw and JBossWS-CXF: Part 1 – Securing the BPEL process

In these posts we will explain how to add security to a BPEL process deployed in RiftSaw when using jbossws-cxf. This first post will explore how to make a BPEL process secure. To demonstrate how to achieve this, we will use the secure_service quickstart example, included in the RiftSaw distribution.

When making a standard JAX-WS service secure, jbossws-cxf simply requires a CXF based configuration file to be bundled with the deployed service [1]. This file is called jbossws-cxf.xml, and for our example, this would have the contents:

<beans xmlns='http://www.springframework.org/schema/beans' 
  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' 
  xmlns:beans='http://www.springframework.org/schema/beans' 
  xmlns:jaxws='http://cxf.apache.org/jaxws' 
  xsi:schemaLocation='http://cxf.apache.org/core 
    http://cxf.apache.org/schemas/core.xsd 
    http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
    http://cxf.apache.org/jaxws 
    http://cxf.apache.org/schemas/jaxws.xsd'> 
   
  <bean id="UsernameTokenSign_Request" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"> 
    <constructor-arg> 
      <map> 
        <entry key="action" value="UsernameToken Timestamp Signature"/> 
        <entry key="passwordType" value="PasswordDigest"/> 
        <entry key="user" value="serverx509v1"/> 
        <entry key="passwordCallbackClass" value="org.jboss.test.ws.jaxws.samples.wsse.ServerUsernamePasswordCallback"/> 
        <entry key="signaturePropFile" value="etc/Server_SignVerf.properties"/> 
        <entry key="signatureKeyIdentifier" value="DirectReference"/> 
      </map> 
    </constructor-arg> 
  </bean> 
   
  <bean id="UsernameTokenSign_Response" class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor"> 
    <constructor-arg> 
      <map> 
        <entry key="action" value="UsernameToken Timestamp Signature"/> 
        <entry key="passwordType" value="PasswordText"/> 
        <entry key="user" value="serverx509v1"/> 
        <entry key="passwordCallbackClass" value="org.jboss.test.ws.jaxws.samples.wsse.ServerUsernamePasswordCallback"/> 
        <entry key="signaturePropFile" value="etc/Server_Decrypt.properties"/> 
        <entry key="signatureKeyIdentifier" value="DirectReference"/> 
        <entry key="signatureParts" value="{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body"/> 
      </map> 
    </constructor-arg> 
  </bean> 
 
  <jaxws:endpoint 
    id='SecureHelloWorldWS' 
    address='http://@jboss.bind.address@:8080/Quickstart_bpel_secure_serviceWS' 
    implementor='@provider@'> 
    <jaxws:inInterceptors> 
        <ref bean="UsernameTokenSign_Request"/> 
        <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/> 
    </jaxws:inInterceptors> 
    <jaxws:outInterceptors> 
        <ref bean="UsernameTokenSign_Response"/> 
        <bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"/> 
    </jaxws:outInterceptors> 
  </jaxws:endpoint> 

</beans>

To make the BPEL process secure, this file has to be included alongside the BPEL deployment descriptor and process at the top level of the BPEL deployment. This particular configuration uses UsernameToken and digital signature authentication on both the request and response.

The only difference between the contents of this file, and one that would be deployed with a JAX-WS service, is the implementor attribute on the jaxws:endpoint element. In the file above, the value of this attribute is @provider@. In a standard JAX-WS configuration, this value would be the class name implementing the JAX-WS service. The reason RiftSaw uses this alternative value, is that the class implementing the JAX-WS service is not known until deployment time, as it is dynamically created, and so it's class name will be substituted during deployment.

As you will note, the configuration references some property files in a relative sub-folder called etc. These property files also reference some keystore files stored in another relative sub-folder called keystore. Both of these relative sub-folders simply need to be stored at the top level of the BPEL deployment jar.

The configuration also defines a passwordCallbackClass, which must specify a class that implements the javax.security.auth.callback.CallbackHandler interface. In the secure_service example, this class is bundled with the BPEL deployment jar. However this property can reference any implementation that may already exist within the JBossAS server.

So to summarize, securing a BPEL process only requires the addition of a jbossws-cxf configuration file with supporting property and keystore information, and access to an appropriate CallbackHandler implementation.

[1] http://community.jboss.org/wiki/Jbossws-stackcxfUserGuide#WSSecurity

Tuesday, July 27, 2010

Links of RiftSaw/Ode architecture

I've composed a series blog entries on Ode architecture, because riftsaw leverages the Ode's bpel runtime, so it applies to the riftsaw project also, hope it will help you easily understood how riftsaw works.

1. Bpel Compiler and its internal model.
2. Jacob framework.
3. Ode's architecture and module introduction.
4. BpelServer API illustration.
5. Architecture of simple scheduler module.


Friday, July 16, 2010

RiftSaw Release 2.1.0.Final

The RiftSaw team are pleased to announce the release of RiftSaw 2.1.0.Final.

The summary of the main changes between 2.0.0.Final and 2.1.0.Final are:

- Support for WS-Security when RiftSaw used in conjunction with JBossWS-CXF
- UDDI registration and lookup
- Migration of persistence layer to a pure JPA approach, enabling any JPA compliant persistence provider to be used. RiftSaw uses Hibernate as its default JPA provider
- Update from ODE1.3.3 to ODE1.3.4
- ODE project has now been mavenized
- More examples
- Many bug fixes
- Now dependent upon ESB 4.8 or higher (instead of ESB 4.7)

The detailed report for this release can be found at:
https://jira.jboss.org/secure/ReleaseNote.jspa?projectId=12310843&version=12315122

The release can be downloaded from: http://www.jboss.org/riftsaw/downloads.html

Wednesday, July 14, 2010

First screencast on Riftsaw

A screencast showing Riftsaw and JBoss Tools BPEL Modeling in action has just made it into the JBoss Tools Movies. The video shows how to create, assemble, deploy and test a simple BPEL process. In fact it shows how to create an existing sample which is shipped with Riftsaw - the say_hello process.

This process is a modification of a well-known Hello World sample type. User sends his name to the process and gets a "personalized" greeting back. So the BPEL would concat a name, e.g. Dolly with a string Hello and would reply with "Hello Dolly".

You can watch the screen cast at the JBoss Tools Movies.

Friday, June 25, 2010

RiftSaw Release 2.1.0.CR2

The RiftSaw team is pleased to announce the release of 2.1.0.CR2.

This is a bug fix release.

The main change with this release is the migration to the pure JPA persistence layer from the native Hibernate layer. Moving to the JPA persistence layer has resolved a number of long standing bugs.

Hibernate is still used as the JPA provider. However to align the database schema with the ODE community project, it has been necessary to make some schema changes. Therefore it will be necessary to drop the current database (or simply
remove the $AS/server/default/data folder). This JPA work is being contributed back to the ODE project, and should be available in ODE 1.4.

The other main change is the simplification of the ESB examples, both in terms of how they are run, and also in terms of their complexity. Previously the primary ESB/Riftsaw example was too complex, making it difficult to use and follow. Instead this has been replaced by a couple of new simpler examples that demonstrate the specific integration points between JBossESB and RiftSaw.

The detailed report for this release can be found at:
https://jira.jboss.org/secure/ReleaseNote.jspa?projectId=12310843&version=12314933

The release can be downloaded from: http://www.jboss.org/riftsaw/downloads.html.

Friday, June 4, 2010

RiftSaw Release 2.1.0.CR1

The RiftSaw team is pleased to announce the release of 2.1.0.CR1.

This is primarily a bug fix release, with additional support for configuring the Apache CXF web service endpoints used by a BPEL process.

WS-Security features, supported by Apache CXF, can now be configured for RiftSaw when the jboss-cxf Web Service stack is installed. The User Guide provides information on how to include the CXF based configuration with the BPEL deployment, and there are some quickstarts available to demonstrate username and digital signature authentication.

JAX-WS handlers can now be installed to intercept/observe messages sent and returned from the web service representing a BPEL process.

The version of ODE used by RiftSaw has been updated to ODE 1.3.4.

NOTE: Database schema changes occurred when moving to the ODE 1.3.4 release. If you have a previous version of RiftSaw installed, then you will need to drop the existing tables (or delete the database), before installing and running this version of RiftSaw.

The detailed report for this release can be found at:
https://jira.jboss.org/secure/ReleaseNote.jspa?projectId=12310843&version=12314753

The release can be downloaded from: http://www.jboss.org/riftsaw/downloads.html

The RiftSaw Team
http://www.jboss.org/riftsaw