Author: coheigea Date: Wed Jun 13 13:44:09 2012 New Revision: 1349843 URL: http://svn.apache.org/viewvc?rev=1349843&view=rev Log: Merged revisions 1349831 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
........ r1349831 | coheigea | 2012-06-13 14:22:04 +0100 (Wed, 13 Jun 2012) | 10 lines Merged revisions 1349825 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/trunk ........ r1349825 | coheigea | 2012-06-13 14:10:54 +0100 (Wed, 13 Jun 2012) | 2 lines [CXF-4376] - STS encryptIssuedToken with the SymmetricKey KeyType does not work ........ ........ Modified: cxf/branches/2.5.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java cxf/branches/2.5.x-fixes/services/sts/sts-war/src/main/webapp/WEB-INF/cxf-encrypted-ut.xml cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/cxf-encrypted-ut.xml cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/symmetric/DoubleIt.wsdl cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/symmetric/cxf-client.xml cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/symmetric/cxf-service.xml Modified: cxf/branches/2.5.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java?rev=1349843&r1=1349842&r2=1349843&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java (original) +++ cxf/branches/2.5.x-fixes/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java Wed Jun 13 13:44:09 2012 @@ -305,8 +305,7 @@ public class TokenIssueOperation extends } /** - * Construct a token containing the secret to return to the client. If encryptIssuedToken is set - * then the token is wrapped in an EncryptedKey DOM element, otherwise it is returned in a + * Construct a token containing the secret to return to the client. The secret is returned in a * BinarySecretType JAXBElement. */ private Object constructSecretToken( @@ -314,17 +313,17 @@ public class TokenIssueOperation extends EncryptionProperties encryptionProperties, KeyRequirements keyRequirements ) throws WSSecurityException { - if (encryptIssuedToken) { + /*if (encryptIssuedToken) { return encryptSecret(secret, encryptionProperties, keyRequirements); } else { - BinarySecretType binarySecretType = QNameConstants.WS_TRUST_FACTORY.createBinarySecretType(); - String nonce = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/Nonce"; - binarySecretType.setType(nonce); - binarySecretType.setValue(secret); - JAXBElement<BinarySecretType> binarySecret = + */ + BinarySecretType binarySecretType = QNameConstants.WS_TRUST_FACTORY.createBinarySecretType(); + String nonce = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/Nonce"; + binarySecretType.setType(nonce); + binarySecretType.setValue(secret); + JAXBElement<BinarySecretType> binarySecret = QNameConstants.WS_TRUST_FACTORY.createBinarySecret(binarySecretType); - return binarySecret; - } + return binarySecret; } } Modified: cxf/branches/2.5.x-fixes/services/sts/sts-war/src/main/webapp/WEB-INF/cxf-encrypted-ut.xml URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/services/sts/sts-war/src/main/webapp/WEB-INF/cxf-encrypted-ut.xml?rev=1349843&r1=1349842&r2=1349843&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/services/sts/sts-war/src/main/webapp/WEB-INF/cxf-encrypted-ut.xml (original) +++ cxf/branches/2.5.x-fixes/services/sts/sts-war/src/main/webapp/WEB-INF/cxf-encrypted-ut.xml Wed Jun 13 13:44:09 2012 @@ -63,7 +63,7 @@ </bean> <util:list id="encryptedUtEndpoints"> - <value>http://localhost:(\d)*/doubleit/services/doubleitasymmetricsaml1encrypted + <value>http://localhost:(\d)*/doubleit/services/doubleit(a)?symmetricsaml1encrypted </value> </util:list> Modified: cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java?rev=1349843&r1=1349842&r2=1349843&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java (original) +++ cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java Wed Jun 13 13:44:09 2012 @@ -130,6 +130,32 @@ public class SymmetricBindingTest extend bus.shutdown(true); } + + // TODO Re-enable this when we pick up WSS4J 1.6.7 + @org.junit.Test + @org.junit.Ignore + public void testUsernameTokenSAML1Encrypted() throws Exception { + SpringBusFactory bf = new SpringBusFactory(); + URL busFile = SymmetricBindingTest.class.getResource("cxf-client.xml"); + + Bus bus = bf.createBus(busFile.toString()); + SpringBusFactory.setDefaultBus(bus); + SpringBusFactory.setThreadDefaultBus(bus); + + URL wsdl = SymmetricBindingTest.class.getResource("DoubleIt.wsdl"); + Service service = Service.create(wsdl, SERVICE_QNAME); + QName portQName = new QName(NAMESPACE, "DoubleItSymmetricSAML1EncryptedPort"); + DoubleItPortType symmetricSaml1Port = + service.getPort(portQName, DoubleItPortType.class); + updateAddressPort(symmetricSaml1Port, PORT); + if (standalone) { + TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml1Port, STSPORT2); + } + + doubleIt(symmetricSaml1Port, 25); + + bus.shutdown(true); + } private static void doubleIt(DoubleItPortType port, int numToDouble) { int resp = port.doubleIt(numToDouble); Modified: cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/cxf-encrypted-ut.xml URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/cxf-encrypted-ut.xml?rev=1349843&r1=1349842&r2=1349843&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/cxf-encrypted-ut.xml (original) +++ cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/cxf-encrypted-ut.xml Wed Jun 13 13:44:09 2012 @@ -65,7 +65,7 @@ </bean> <util:list id="encryptedUtEndpoints"> - <value>http://localhost:(\d)*/doubleit/services/doubleitasymmetricsaml1encrypted + <value>http://localhost:(\d)*/doubleit/services/doubleit(a)?symmetricsaml1encrypted </value> </util:list> Modified: cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/symmetric/DoubleIt.wsdl URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/symmetric/DoubleIt.wsdl?rev=1349843&r1=1349842&r2=1349843&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/symmetric/DoubleIt.wsdl (original) +++ cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/symmetric/DoubleIt.wsdl Wed Jun 13 13:44:09 2012 @@ -70,6 +70,10 @@ <soap:address location="http://localhost:8082/doubleit/services/doubleitsymmetricsaml2" /> </wsdl:port> + <wsdl:port name="DoubleItSymmetricSAML1EncryptedPort" binding="tns:DoubleItSymmetricSAML1Binding"> + <soap:address + location="http://localhost:8082/doubleit/services/doubleitsymmetricsaml1encrypted" /> + </wsdl:port> </wsdl:service> <wsp:Policy wsu:Id="DoubleItSymmetricBindingSAML1Policy"> Modified: cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/symmetric/cxf-client.xml URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/symmetric/cxf-client.xml?rev=1349843&r1=1349842&r2=1349843&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/symmetric/cxf-client.xml (original) +++ cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/symmetric/cxf-client.xml Wed Jun 13 13:44:09 2012 @@ -89,5 +89,32 @@ http://cxf.apache.org/configuration/secu </jaxws:properties> </jaxws:client> + <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItSymmetricSAML1EncryptedPort" + createdFromAPI="true"> + <jaxws:properties> + <entry key="ws-security.sts.client"> + <bean class="org.apache.cxf.ws.security.trust.STSClient"> + <constructor-arg ref="cxf"/> + <property name="wsdlLocation" + value="http://localhost:8080/SecurityTokenService/UTEncrypted?wsdl"/> + <property name="serviceName" + value="{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}SecurityTokenService"/> + <property name="endpointName" + value="{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}UTEncrypted_Port"/> + <property name="properties"> + <map> + <entry key="ws-security.username" value="alice"/> + <entry key="ws-security.callback-handler" + value="org.apache.cxf.systest.sts.common.CommonCallbackHandler"/> + <entry key="ws-security.encryption.properties" value="clientKeystore.properties"/> + <entry key="ws-security.encryption.username" value="mystskey"/> + <entry key="ws-security.is-bsp-compliant" value="false"/> + </map> + </property> + </bean> + </entry> + </jaxws:properties> + </jaxws:client> + </beans> Modified: cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/symmetric/cxf-service.xml URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/symmetric/cxf-service.xml?rev=1349843&r1=1349842&r2=1349843&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/symmetric/cxf-service.xml (original) +++ cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/symmetric/cxf-service.xml Wed Jun 13 13:44:09 2012 @@ -71,5 +71,21 @@ </jaxws:properties> </jaxws:endpoint> + <jaxws:endpoint id="doubleitsymmetricsaml1encrypted" + implementor="org.apache.cxf.systest.sts.common.DoubleItPortTypeImpl" + endpointName="s:DoubleItSymmetricSAML1EncryptedPort" + serviceName="s:DoubleItService" + address="http://localhost:${testutil.ports.Server}/doubleit/services/doubleitsymmetricsaml1encrypted" + wsdlLocation="org/apache/cxf/systest/sts/symmetric/DoubleIt.wsdl" + xmlns:s="http://www.example.org/contract/DoubleIt"> + + <jaxws:properties> + <entry key="ws-security.callback-handler" + value="org.apache.cxf.systest.sts.common.CommonCallbackHandler"/> + <entry key="ws-security.signature.properties" value="serviceKeystore.properties"/> + <entry key="ws-security.is-bsp-compliant" value="false"/> + </jaxws:properties> + </jaxws:endpoint> + </beans>
