Is it possible to use these together?  I took a stab at it and this is my
service.xml and client policy xml:

I added the following block to the service.xml prior to the rampart element
and I did the same for the policy.xml.  I used sample02 as the test service
and client.

<sp:SignedSupportingTokens
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>
  <wsp:Policy>
      <sp:UsernameToken
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient";
/>
  </wsp:Policy>
</sp:SignedSupportingTokens>


Service.xml:

<?xml version="1.0" encoding="UTF-8"?>
<service>
    <operation name="echo">
        <messageReceiver
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </operation>
    <parameter name="ServiceClass"
locked="false">org.apache.rampart.samples.policy.sample02.SimpleService</parameter>

    <module ref="rampart"/>
    <module ref="addressing"/>

    <wsp:Policy wsu:Id="SigOnly"
               
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
                xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy";>
        <wsp:ExactlyOne>
            <wsp:All>
                <sp:AsymmetricBinding
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>
                    <wsp:Policy>
                        <sp:InitiatorToken>
                            <wsp:Policy>
                                <sp:X509Token
                                       
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient";>
                                    <wsp:Policy>
                                        <sp:RequireThumbprintReference/>
                                        <sp:WssX509V3Token10/>
                                    </wsp:Policy>
                                </sp:X509Token>
                            </wsp:Policy>
                        </sp:InitiatorToken>
                        <sp:RecipientToken>
                            <wsp:Policy>
                                <sp:X509Token
                                       
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never";>
                                    <wsp:Policy>
                                        <sp:RequireThumbprintReference/>
                                        <sp:WssX509V3Token10/>
                                    </wsp:Policy>
                                </sp:X509Token>
                            </wsp:Policy>
                        </sp:RecipientToken>
                        <sp:AlgorithmSuite>
                            <wsp:Policy>
                                <sp:TripleDesRsa15/>
                            </wsp:Policy>
                        </sp:AlgorithmSuite>
                        <sp:Layout>
                            <wsp:Policy>
                                <sp:Strict/>
                            </wsp:Policy>
                        </sp:Layout>
                        <sp:IncludeTimestamp/>
                        <sp:OnlySignEntireHeadersAndBody/>
                    </wsp:Policy>
                </sp:AsymmetricBinding>
                <sp:Wss10
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>
                    <wsp:Policy>
                        <sp:MustSupportRefKeyIdentifier/>
                        <sp:MustSupportRefIssuerSerial/>
                    </wsp:Policy>
                </sp:Wss10>
                <sp:SignedParts
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>
                    <sp:Body/>
                </sp:SignedParts>

                    <sp:SignedSupportingTokens
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>
                      <wsp:Policy>
                        <sp:UsernameToken
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient";
/>
                      </wsp:Policy>
                    </sp:SignedSupportingTokens>

                <ramp:RampartConfig
xmlns:ramp="http://ws.apache.org/rampart/policy";>
                    <ramp:user>myUser</ramp:user>
                    <ramp:encryptionUser>jksUser</ramp:encryptionUser>
                   
<ramp:passwordCallbackClass>org.apache.rampart.samples.policy.sample02.PWCBHandler</ramp:passwordCallbackClass>

                    <ramp:signatureCrypto>
                        <ramp:crypto
provider="org.apache.ws.security.components.crypto.Merlin">
                            <ramp:property
name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
                            <ramp:property
name="org.apache.ws.security.crypto.merlin.file">myJKS.jks</ramp:property>
                            <ramp:property
name="org.apache.ws.security.crypto.merlin.keystore.password">jksPSWD</ramp:property>
                        </ramp:crypto>
                    </ramp:signatureCrypto>
                </ramp:RampartConfig>

            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>
</service>

policy.xml:

<?xml version="1.0" encoding="UTF-8"?>
<wsp:Policy wsu:Id="SigOnly"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy";>
        <wsp:ExactlyOne>
                <wsp:All>
                        <sp:AsymmetricBinding
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>
                                <wsp:Policy>
                                        <sp:InitiatorToken>
                                                <wsp:Policy>
                                                        <sp:X509Token
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient";>
                                                                <wsp:Policy>
                                                                        
<sp:WssX509V3Token10/>
                                                                </wsp:Policy>
                                                        </sp:X509Token>
                                                </wsp:Policy>
                                        </sp:InitiatorToken>
                                        <sp:RecipientToken>
                                                <wsp:Policy>
                                                        <sp:X509Token
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never";>
                                                                <wsp:Policy>
                                                                        
<sp:WssX509V3Token10/>
                                                                </wsp:Policy>
                                                        </sp:X509Token>
                                                </wsp:Policy>
                                        </sp:RecipientToken>
                                        <sp:AlgorithmSuite>
                                                <wsp:Policy>
                                                        <sp:TripleDesRsa15/>
                                                </wsp:Policy>
                                        </sp:AlgorithmSuite>
                                        <sp:Layout>
                                                <wsp:Policy>
                                                        <sp:Strict/>
                                                </wsp:Policy>
                                        </sp:Layout>
                                        <sp:IncludeTimestamp/>
                                        <sp:OnlySignEntireHeadersAndBody/>
                                </wsp:Policy>
                        </sp:AsymmetricBinding>
                        <sp:Wss10
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>
                                <wsp:Policy>
                                        <sp:MustSupportRefKeyIdentifier/>
                                        <sp:MustSupportRefIssuerSerial/>
                                </wsp:Policy>
                        </sp:Wss10>

                        <sp:SignedParts
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>
                                <sp:Body/>
                        </sp:SignedParts>

                <sp:SignedSupportingTokens
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>
                        <wsp:Policy>
                                <sp:UsernameToken
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient";
/>
                  </wsp:Policy>
                </sp:SignedSupportingTokens>

                        <ramp:RampartConfig 
xmlns:ramp="http://ws.apache.org/rampart/policy";> 
                                <ramp:user>myUser</ramp:user>
                                
<ramp:encryptionUser>jksUser</ramp:encryptionUser>
                        
<ramp:passwordCallbackClass>org.apache.rampart.samples.policy.sample02.PWCBHandler</ramp:passwordCallbackClass>
                                
                <ramp:sslConfig> 
                  <ramp:property
name="javax.net.ssl.trustStore">myJKS.jks</ramp:property>
                  <ramp:property
name="javax.net.ssl.trustStorePassword">jksPSWD</ramp:property> 
                </ramp:sslConfig>
                                
                                <ramp:signatureCrypto>
                                        <ramp:crypto
provider="org.apache.ws.security.components.crypto.Merlin">
                                                <ramp:property
name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
                                                <ramp:property
name="org.apache.ws.security.crypto.merlin.file">myJKS.jks</ramp:property>
                                                <ramp:property
name="org.apache.ws.security.crypto.merlin.keystore.password">jksPSWD</ramp:property>
                                        </ramp:crypto>
                                </ramp:signatureCrypto>
                        </ramp:RampartConfig>

                </wsp:All>
        </wsp:ExactlyOne>
</wsp:Policy>

-- 
View this message in context: 
http://www.nabble.com/How-to-use-Username-Token-and-Signature-Policy-Together-tp25262491p25262491.html
Sent from the Axis - User mailing list archive at Nabble.com.

Reply via email to