mulesoft / api-policies

18 stars 34 forks source link

Basic Auth to WS-Security Transformation Policy not working with GW 2.0 #1

Closed jesica-fera closed 9 years ago

jesica-fera commented 9 years ago

The policy does not work properly in GW 2.0 because with the new Http Module. Class org.jboss.netty.buffer.ChannelBufferInputStream is not compatible anymore since netty transport was removed in 2.0. The policy shouldn't be dependent of any specific transport internals (unless it is unavoidable). To avoid the dependency it could be changed as follows. The original policy has:

<!-- continue only if the message payloadof InputStream data type is present -->
    <mule:message-filter xmlns:mule="http://www.mulesoft.org/schema/mule/core" 
     onUnaccepted="payloadViolation">
   <mule:expression-filter xmlns:mule="http://www.mulesoft.org/schema/mule/core" 
     expression="#[payload instanceof org.jboss.netty.buffer.ChannelBufferInputStream]" 
     name="PayloadFilter"/>
   </mule:message-filter>

And this should be fixed with:

<!-- continue only if the message payloadof InputStream data type is present -->
    <mule:message-filter xmlns:mule="http://www.mulesoft.org/schema/mule/core" 
        onUnaccepted="payloadViolation">
    <mule:expression-filter xmlns:mule="http://www.mulesoft.org/schema/mule/core" 
       expression="#[payload instanceof java.io.InputStream]" name="PayloadFilter"/>
    </mule:message-filter>
rusinm commented 9 years ago

Thanks for your comments. It was fixed.