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 179CBFC28 for ; Mon, 28 Apr 2014 17:42:52 +0000 (UTC) Received: (qmail 32395 invoked by uid 500); 28 Apr 2014 17:42:33 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 32203 invoked by uid 500); 28 Apr 2014 17:42:26 -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 32112 invoked by uid 99); 28 Apr 2014 17:42:21 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Apr 2014 17:42:20 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 5B760998BDE; Mon, 28 Apr 2014 17:42:20 +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: Mon, 28 Apr 2014 17:42:21 -0000 Message-Id: <0c33af1695bf4a23abbfd589dd91d457@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/2] git commit: Minor change Minor change Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1b0e2fe2 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1b0e2fe2 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1b0e2fe2 Branch: refs/heads/master Commit: 1b0e2fe2d41956f2a5936be6e58da5fa9792213b Parents: 099c710 Author: Colm O hEigeartaigh Authored: Mon Apr 28 18:42:04 2014 +0100 Committer: Colm O hEigeartaigh Committed: Mon Apr 28 18:42:04 2014 +0100 ---------------------------------------------------------------------- .../policy/interceptors/NegotiationUtils.java | 28 +++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/1b0e2fe2/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java ---------------------------------------------------------------------- diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java index 71c7b35..be7c05b 100644 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/NegotiationUtils.java @@ -81,19 +81,19 @@ final class NegotiationUtils { } static Trust10 getTrust10(AssertionInfoMap aim) { - Collection ais = getAllAssertionsByLocalname(aim, SPConstants.TRUST_10); - if (ais.isEmpty()) { + AssertionInfo ai = getFirstAssertionByLocalname(aim, SPConstants.TRUST_10); + if (ai == null) { return null; } - return (Trust10)ais.iterator().next().getAssertion(); + return (Trust10)ai.getAssertion(); } static Trust13 getTrust13(AssertionInfoMap aim) { - Collection ais = getAllAssertionsByLocalname(aim, SPConstants.TRUST_13); - if (ais.isEmpty()) { + AssertionInfo ai = getFirstAssertionByLocalname(aim, SPConstants.TRUST_13); + if (ai == null) { return null; } - return (Trust13)ais.iterator().next().getAssertion(); + return (Trust13)ai.getAssertion(); } static TokenStore getTokenStore(Message message) { @@ -331,6 +331,22 @@ final class NegotiationUtils { return Collections.emptySet(); } + static AssertionInfo getFirstAssertionByLocalname( + AssertionInfoMap aim, String localname + ) { + Collection sp11Ais = aim.get(new QName(SP11Constants.SP_NS, localname)); + if (sp11Ais != null && !sp11Ais.isEmpty()) { + return sp11Ais.iterator().next(); + } + + Collection sp12Ais = aim.get(new QName(SP12Constants.SP_NS, localname)); + if (sp12Ais != null && !sp12Ais.isEmpty()) { + return sp12Ais.iterator().next(); + } + + return null; + } + static boolean isThereAnAssertionByLocalname( AssertionInfoMap aim, String localname