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 <[email protected]> Authored: Mon Apr 28 18:42:04 2014 +0100 Committer: Colm O hEigeartaigh <[email protected]> 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<AssertionInfo> 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<AssertionInfo> 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<AssertionInfo> sp11Ais = aim.get(new QName(SP11Constants.SP_NS, localname)); + if (sp11Ais != null && !sp11Ais.isEmpty()) { + return sp11Ais.iterator().next(); + } + + Collection<AssertionInfo> 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
