Signing All headers including Elements ReplyTo, To, MessageId and Action With Apache Axis2 and Rampart

633 views Asked by At

I need to sign WS-Addressing elements in my soap message. Is it possible with apache axis2 ws-addresing and rampart?

I've found this example - sample2 http://axis.apache.org/axis2/java/rampart/samples.html. But ws-addressing elements are not signed.

EDIT!!!

this is definition from my Policy file. It does not work!

<wsp:Policy wsu:Id="DefaultEndpoint_Echo_output_policy">
<wsp:ExactlyOne>
  <wsp:All>
    <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
      <sp:Body/>
      <sp:Header Name="To" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/>
      <sp:Header Name="From" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/>
      <sp:Header Name="FaultTo" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/>
      <sp:Header Name="ReplyTo" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/>
      <sp:Header Name="MessageID" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/>
      <sp:Header Name="RelatesTo" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/>
      <sp:Header Name="Action" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/>
    </sp:SignedParts>
  </wsp:All>
</wsp:ExactlyOne>

1

There are 1 answers

0
tomde On BEST ANSWER

I have solved this issue by removing all children tags from SignedParts tag

So my policy definition looks like this.

<wsp:ExactlyOne>
  <wsp:All>
    <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy</sp:SignedParts>
  </wsp:All>
</wsp:ExactlyOne>

I've found out that as long as you don't define any tags for signing and you include just empty tag SignedParts it will automatically sign all headers and body.