Skip to content

Commit

Permalink
Merged revisions 1564731 via git cherry-pick from
Browse files Browse the repository at this point in the history
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

........
  r1564731 | coheigea | 2014-02-05 12:15:51 +0000 (Wed, 05 Feb 2014) | 9 lines

  Another EncryptBeforeSigning fix

  Conflicts:
  	systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl
  	systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client.xml
  	systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server.xml
  	systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/stax-server.xml

........

git-svn-id: https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes@1564738 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
coheigea committed Feb 5, 2014
1 parent e8fb17f commit 2d2fd1b
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ private void doEncryptBeforeSign() {
this.addDerivedKeyElement(secondRefList);
} else if (!secondEncrParts.isEmpty()) {
//Encrypt, get hold of the ref list and add it
secondRefList = ((WSSecEncrypt)encr).encryptForRef(null, encrParts);
secondRefList = ((WSSecEncrypt)encr).encryptForRef(null, secondEncrParts);
this.addDerivedKeyElement(secondRefList);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,29 @@ public void testAsymmetricUsernameToken() throws Exception {
bus.shutdown(true);
}

@org.junit.Test
public void testSymmetricUsernameToken() throws Exception {

SpringBusFactory bf = new SpringBusFactory();
URL busFile = X509TokenTest.class.getResource("client/client.xml");

Bus bus = bf.createBus(busFile.toString());
SpringBusFactory.setDefaultBus(bus);
SpringBusFactory.setThreadDefaultBus(bus);

URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItSymmetricUsernameTokenPort");
DoubleItPortType x509Port =
service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(x509Port, PORT);

x509Port.doubleIt(25);

((java.io.Closeable)x509Port).close();
bus.shutdown(true);
}

@org.junit.Test
public void testSymmetricProtectTokens() throws Exception {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,24 @@
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="DoubleItSymmetricUsernameTokenBinding" type="tns:DoubleItPortType">
<wsp:PolicyReference URI="#DoubleItSymmetricUsernameTokenPolicy"/>
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="DoubleIt">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
<wsp:PolicyReference URI="#DoubleItBinding_DoubleIt_Input_Policy"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
<wsp:PolicyReference URI="#DoubleItBinding_DoubleIt_Output_Policy"/>
</wsdl:output>
<wsdl:fault name="DoubleItFault">
<soap:body use="literal" name="DoubleItFault"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="DoubleItSymmetricProtectTokensBinding" type="tns:DoubleItPortType">
<wsp:PolicyReference URI="#DoubleItSymmetricProtectTokensPolicy" />
<soap:binding style="document"
Expand Down Expand Up @@ -469,6 +487,9 @@
binding="tns:DoubleItAsymmetricUsernameTokenBinding">
<soap:address location="http://localhost:9001/DoubleItX509AsymmetricUsernameToken" />
</wsdl:port>
<wsdl:port name="DoubleItSymmetricUsernameTokenPort" binding="tns:DoubleItSymmetricUsernameTokenBinding">
<soap:address location="http://localhost:9001/DoubleItX509SymmetricUsernameToken"/>
</wsdl:port>
<wsdl:port name="DoubleItSymmetricProtectTokensPort"
binding="tns:DoubleItSymmetricProtectTokensBinding">
<soap:address location="http://localhost:9001/DoubleItX509SymmetricProtect" />
Expand Down Expand Up @@ -953,6 +974,49 @@
</wsp:ExactlyOne>
</wsp:Policy>

<wsp:Policy wsu:Id="DoubleItSymmetricUsernameTokenPolicy">
<wsp:ExactlyOne>
<wsp:All>
<sp:SymmetricBinding>
<wsp:Policy>
<sp:ProtectionToken>
<wsp:Policy>
<sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never">
<wsp:Policy>
<sp:WssX509V3Token11/>
<sp:RequireThumbprintReference/>
</wsp:Policy>
</sp:X509Token>
</wsp:Policy>
</sp:ProtectionToken>
<sp:Layout>
<wsp:Policy>
<sp:Lax/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
<sp:OnlySignEntireHeadersAndBody/>
<sp:EncryptBeforeSigning/>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic128/>
</wsp:Policy>
</sp:AlgorithmSuite>
</wsp:Policy>
</sp:SymmetricBinding>
<sp:EncryptedSupportingTokens>
<wsp:Policy>
<sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssUsernameToken11/>
</wsp:Policy>
</sp:UsernameToken>
</wsp:Policy>
</sp:EncryptedSupportingTokens>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>

<wsp:Policy wsu:Id="DoubleItSymmetricProtectTokensPolicy">
<wsp:ExactlyOne>
<wsp:All>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,17 @@
</jaxws:properties>
</jaxws:client>

<jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSymmetricUsernameTokenPort" createdFromAPI="true">
<jaxws:properties>
<entry key="ws-security.encryption.properties"
value="org/apache/cxf/systest/ws/wssec10/client/bob.properties"/>
<entry key="ws-security.encryption.username" value="bob"/>
<entry key="ws-security.username" value="alice"/>
<entry key="ws-security.callback-handler"
value="org.apache.cxf.systest.ws.wssec10.client.KeystorePasswordCallback"/>
</jaxws:properties>
</jaxws:client>

<jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSymmetricProtectTokensPort"
createdFromAPI="true">
<jaxws:properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,15 @@

</jaxws:endpoint>

<jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="SymmetricUsernameToken" address="http://localhost:${testutil.ports.Server}/DoubleItX509SymmetricUsernameToken" serviceName="s:DoubleItService" endpointName="s:DoubleItSymmetricUsernameTokenPort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl">
<jaxws:properties>
<entry key="ws-security.callback-handler"
value="org.apache.cxf.systest.ws.wssec10.client.KeystorePasswordCallback"/>
<entry key="ws-security.signature.properties"
value="org/apache/cxf/systest/ws/wssec10/client/bob.properties"/>
</jaxws:properties>
</jaxws:endpoint>

<jaxws:endpoint
id="SymmetricProtectTokens"
address="http://localhost:${testutil.ports.Server}/DoubleItX509SymmetricProtect"
Expand Down

0 comments on commit 2d2fd1b

Please sign in to comment.