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 C088117633 for ; Tue, 12 May 2015 13:17:41 +0000 (UTC) Received: (qmail 71145 invoked by uid 500); 12 May 2015 13:17:36 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 70932 invoked by uid 500); 12 May 2015 13:17:36 -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 70791 invoked by uid 99); 12 May 2015 13:17:36 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 May 2015 13:17:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 65FFDDFF07; Tue, 12 May 2015 13:17:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: coheigea@apache.org To: commits@cxf.apache.org Date: Tue, 12 May 2015 13:17:38 -0000 Message-Id: In-Reply-To: <41af8fdae7164f6ab8d29d7ea3cd5f83@git.apache.org> References: <41af8fdae7164f6ab8d29d7ea3cd5f83@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/3] cxf git commit: [CXF-6400] - Make ws-security.callback-handler optional for generating a WS-Security signature [CXF-6400] - Make ws-security.callback-handler optional for generating a WS-Security signature Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a64265c2 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a64265c2 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a64265c2 Branch: refs/heads/master Commit: a64265c29be124e9bffb46eb35a68b3504860c3a Parents: 4b489ff Author: Colm O hEigeartaigh Authored: Tue May 12 11:33:05 2015 +0100 Committer: Colm O hEigeartaigh Committed: Tue May 12 14:17:32 2015 +0100 ---------------------------------------------------------------------- .../policyhandlers/AbstractBindingBuilder.java | 18 +++++++++++++++--- .../policyhandlers/TransportBindingHandler.java | 3 --- 2 files changed, 15 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/a64265c2/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java ---------------------------------------------------------------------- diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java index 1e85cc1..94e68bd 100644 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java @@ -921,18 +921,30 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle return id; } - public String getPassword(String userName, Assertion info, int usage) { + protected String getPassword(String userName, Assertion info, int usage) { //Then try to get the password from the given callback handler Object o = SecurityUtils.getSecurityPropertyValue(SecurityConstants.CALLBACK_HANDLER, message); CallbackHandler handler = null; try { handler = SecurityUtils.getCallbackHandler(o); if (handler == null) { - unassertPolicy(info, "No callback handler and no password available"); + // Don't unassert for signature as we might get the password from the crypto properties + if (usage == WSPasswordCallback.SIGNATURE) { + LOG.info("No CallbackHandler available to retrieve a password. We will now try the crypto " + + "properties file for a private password"); + } else { + unassertPolicy(info, "No callback handler and no password available"); + } return null; } } catch (Exception ex) { - unassertPolicy(info, "No callback handler and no password available"); + // Don't unassert for signature as we might get the password from the crypto properties + if (usage == WSPasswordCallback.SIGNATURE) { + LOG.info("No CallbackHandler available to retrieve a password. We will now try the crypto " + + "properties file for a private password"); + } else { + unassertPolicy(info, "No callback handler and no password available"); + } return null; } http://git-wip-us.apache.org/repos/asf/cxf/blob/a64265c2/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java ---------------------------------------------------------------------- diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java index 34e2c56..12b111b 100644 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java @@ -571,9 +571,6 @@ public class TransportBindingHandler extends AbstractBindingBuilder { uname = (String)SecurityUtils.getSecurityPropertyValue(userNameKey, message); } String password = getPassword(uname, token, WSPasswordCallback.SIGNATURE); - if (password == null) { - password = ""; - } sig.setUserInfo(uname, password); sig.setSignatureAlgorithm(binding.getAlgorithmSuite().getAsymmetricSignature()); } else {