Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 1237 invoked from network); 18 Dec 2008 21:27:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Dec 2008 21:27:39 -0000 Received: (qmail 5489 invoked by uid 500); 18 Dec 2008 21:27:52 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 5452 invoked by uid 500); 18 Dec 2008 21:27:52 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 5443 invoked by uid 99); 18 Dec 2008 21:27:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Dec 2008 13:27:51 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Dec 2008 21:27:30 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C8E76238889E; Thu, 18 Dec 2008 13:27:09 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r727830 - in /cxf/trunk: rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/ rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/ systests/src/test/java/org/apache/cxf/systest/ws/security/ Date: Thu, 18 Dec 2008 21:27:09 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081218212709.C8E76238889E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Thu Dec 18 13:27:09 2008 New Revision: 727830 URL: http://svn.apache.org/viewvc?rev=727830&view=rev Log: Fix problem of wrong Crypto's being used due to cache keys Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java?rev=727830&r1=727829&r2=727830&view=diff ============================================================================== --- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java (original) +++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AbstractWSS4JInterceptor.java Thu Dec 18 13:27:09 2008 @@ -251,16 +251,13 @@ } Object s = message.getContextualProperty(SecurityConstants.SIGNATURE_PROPERTIES); Object e = message.getContextualProperty(SecurityConstants.ENCRYPT_PROPERTIES); - if (isRequestor(message)) { - message.put("SignaturePropRefId", "SigRefId"); - message.put("SigRefId", getProps(e, message)); - message.put("decryptionPropRefId", "DecRefId"); - message.put("DecRefId", getProps(s, message)); - } else { - message.put("SignaturePropRefId", "SigRefId"); - message.put("SigRefId", getProps(s, message)); - message.put("decryptionPropRefId", "DecRefId"); - message.put("DecRefId", getProps(e, message)); + if (e != null) { + message.put("SignaturePropRefId", "RefId-" + e.toString()); + message.put("RefId-" + e.toString(), getProps(e, message)); + } + if (s != null) { + message.put("decryptionPropRefId", "RefId-" + s.toString()); + message.put("RefId-" + s.toString(), getProps(s, message)); } ai.setAsserted(true); policyAsserted(aim, abinding.getInitiatorToken()); @@ -291,15 +288,23 @@ s = e; } if (isRequestor(message)) { - message.put("SignaturePropRefId", "SigRefId"); - message.put("SigRefId", getProps(e, message)); - message.put("decryptionPropRefId", "DecRefId"); - message.put("DecRefId", getProps(s, message)); + if (e != null) { + message.put("SignaturePropRefId", "RefId-" + e.toString()); + message.put("RefId-" + e.toString(), getProps(e, message)); + } + if (s != null) { + message.put("decryptionPropRefId", "RefId-" + s.toString()); + message.put("RefId-" + s.toString(), getProps(s, message)); + } } else { - message.put("SignaturePropRefId", "SigRefId"); - message.put("SigRefId", getProps(s, message)); - message.put("decryptionPropRefId", "DecRefId"); - message.put("DecRefId", getProps(e, message)); + if (s != null) { + message.put("SignaturePropRefId", "RefId-" + s.toString()); + message.put("RefId-" + s.toString(), getProps(s, message)); + } + if (e != null) { + message.put("decryptionPropRefId", "RefId-" + e.toString()); + message.put("RefId-" + e.toString(), getProps(e, message)); + } } ai.setAsserted(true); policyAsserted(aim, abinding.getEncryptionToken()); Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java?rev=727830&r1=727829&r2=727830&view=diff ============================================================================== --- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java (original) +++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java Thu Dec 18 13:27:09 2008 @@ -169,9 +169,9 @@ tokenId = getEncryptedKey(); } } - if (tok != null) { + if (tok == null) { if (tokenId == null || tokenId.length() == 0) { - //REVISIT - no tokenM + //REVISIT - no tokenId? Exception? } if (tokenId.startsWith("#")) { tokenId = tokenId.substring(1); Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java?rev=727830&r1=727829&r2=727830&view=diff ============================================================================== --- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java (original) +++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java Thu Dec 18 13:27:09 2008 @@ -82,26 +82,22 @@ EndpointInfo ei = ep.getServer().getEndpoint().getEndpointInfo(); ei.setProperty(SecurityConstants.CALLBACK_HANDLER, new ServerPasswordCallback()); - ei.setProperty(SecurityConstants.SIGNATURE_USERNAME, "alice"); ei.setProperty(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback()); ei.setProperty(SecurityConstants.SIGNATURE_PROPERTIES, - SecurityPolicyTest.class.getResource("alice.properties").toString()); - ei.setProperty(SecurityConstants.ENCRYPT_USERNAME, "bob"); - ei.setProperty(SecurityConstants.ENCRYPT_PROPERTIES, SecurityPolicyTest.class.getResource("bob.properties").toString()); + ei.setProperty(SecurityConstants.ENCRYPT_PROPERTIES, + SecurityPolicyTest.class.getResource("alice.properties").toString()); ep = (EndpointImpl)Endpoint.publish(POLICY_SIGNENC_ADDRESS, new DoubleItImplSignThenEncrypt()); ei = ep.getServer().getEndpoint().getEndpointInfo(); ei.setProperty(SecurityConstants.CALLBACK_HANDLER, new ServerPasswordCallback()); - ei.setProperty(SecurityConstants.SIGNATURE_USERNAME, "alice"); ei.setProperty(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback()); ei.setProperty(SecurityConstants.SIGNATURE_PROPERTIES, - SecurityPolicyTest.class.getResource("alice.properties").toString()); - ei.setProperty(SecurityConstants.ENCRYPT_USERNAME, "bob"); - ei.setProperty(SecurityConstants.ENCRYPT_PROPERTIES, SecurityPolicyTest.class.getResource("bob.properties").toString()); + ei.setProperty(SecurityConstants.ENCRYPT_PROPERTIES, + SecurityPolicyTest.class.getResource("alice.properties").toString()); } @Test @@ -110,24 +106,20 @@ DoubleItPortType pt; pt = service.getDoubleItPortEncryptThenSign(); - ((BindingProvider)pt).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME, "alice"); ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback()); ((BindingProvider)pt).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES, getClass().getResource("alice.properties")); - ((BindingProvider)pt).getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME, "Bob"); ((BindingProvider)pt).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, getClass().getResource("bob.properties")); pt.doubleIt(BigInteger.valueOf(5)); pt = service.getDoubleItPortSignThenEncrypt(); - ((BindingProvider)pt).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME, "alice"); ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback()); ((BindingProvider)pt).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES, getClass().getResource("alice.properties")); - ((BindingProvider)pt).getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME, "Bob"); ((BindingProvider)pt).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, getClass().getResource("bob.properties")); pt.doubleIt(BigInteger.valueOf(5));