Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B2262985F for ; Thu, 27 Oct 2011 11:50:16 +0000 (UTC) Received: (qmail 46307 invoked by uid 500); 27 Oct 2011 11:50:16 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 46261 invoked by uid 500); 27 Oct 2011 11:50:16 -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 46252 invoked by uid 99); 27 Oct 2011 11:50:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Oct 2011 11:50:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED 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, 27 Oct 2011 11:50:15 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 7BDE52388A32 for ; Thu, 27 Oct 2011 11:49:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1189708 - /cxf/branches/2.4.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AsymmetricBindingPolicyValidator.java Date: Thu, 27 Oct 2011 11:49:55 -0000 To: commits@cxf.apache.org From: coheigea@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111027114955.7BDE52388A32@eris.apache.org> Author: coheigea Date: Thu Oct 27 11:49:55 2011 New Revision: 1189708 URL: http://svn.apache.org/viewvc?rev=1189708&view=rev Log: Added a check for an X.509 token in the InitiatorToken of the AsymmetricBindingPolicyValidator Modified: cxf/branches/2.4.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AsymmetricBindingPolicyValidator.java Modified: cxf/branches/2.4.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AsymmetricBindingPolicyValidator.java URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AsymmetricBindingPolicyValidator.java?rev=1189708&r1=1189707&r2=1189708&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AsymmetricBindingPolicyValidator.java (original) +++ cxf/branches/2.4.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyvalidators/AsymmetricBindingPolicyValidator.java Thu Oct 27 11:49:55 2011 @@ -19,6 +19,8 @@ package org.apache.cxf.ws.security.wss4j.policyvalidators; +import java.security.cert.X509Certificate; + import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -28,6 +30,8 @@ import org.apache.cxf.ws.policy.Assertio import org.apache.cxf.ws.policy.AssertionInfoMap; import org.apache.cxf.ws.security.policy.SP12Constants; import org.apache.cxf.ws.security.policy.model.AsymmetricBinding; +import org.apache.cxf.ws.security.policy.model.Token; +import org.apache.cxf.ws.security.policy.model.X509Token; import org.apache.ws.security.WSConstants; import org.apache.ws.security.WSSecurityEngineResult; @@ -102,6 +106,19 @@ public class AsymmetricBindingPolicyVali AssertionInfoMap aim ) { if (binding.getInitiatorToken() != null) { + Token token = binding.getInitiatorToken().getToken(); + if (token instanceof X509Token) { + for (WSSecurityEngineResult result : signedResults) { + X509Certificate cert = + (X509Certificate)result.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE); + if (cert == null) { + String error = "An X.509 certificate was not used for the initiator token"; + notAssertPolicy(aim, binding.getInitiatorToken().getName(), error); + ai.setNotAsserted(error); + return false; + } + } + } assertPolicy(aim, binding.getInitiatorToken()); if (!checkDerivedKeys( binding.getInitiatorToken(), hasDerivedKeys, signedResults, encryptedResults