Switch to a single custom content list for master
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d28828e4 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d28828e4 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d28828e4 Branch: refs/heads/master Commit: d28828e47a06da5ad81de62dcb74b1d9dbc2370d Parents: 08f3d92 Author: Colm O hEigeartaigh <[email protected]> Authored: Thu Aug 3 17:53:56 2017 +0100 Committer: Colm O hEigeartaigh <[email protected]> Committed: Thu Aug 3 17:53:56 2017 +0100 ---------------------------------------------------------------------- .../apache/cxf/sts/request/RequestParser.java | 2 +- .../cxf/sts/request/TokenRequirements.java | 19 +++---------------- .../systest/sts/custom/CustomClaimsHandler.java | 8 ++++++-- 3 files changed, 10 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/d28828e4/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java index ca91aae..960b9b7 100644 --- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java +++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/RequestParser.java @@ -121,7 +121,7 @@ public class RequestParser { } if (!found) { if (allowCustomContent) { - tokenRequirements.addCustomContentJAXB(jaxbElement); + tokenRequirements.addCustomContent(jaxbElement); } else { LOG.log( Level.WARNING, http://git-wip-us.apache.org/repos/asf/cxf/blob/d28828e4/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/TokenRequirements.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/TokenRequirements.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/TokenRequirements.java index 3021fca..2f96bb8 100644 --- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/TokenRequirements.java +++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/request/TokenRequirements.java @@ -22,8 +22,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import javax.xml.bind.JAXBElement; - import org.w3c.dom.Element; import org.apache.cxf.rt.security.claims.ClaimCollection; @@ -47,8 +45,7 @@ public class TokenRequirements { private ClaimCollection secondaryClaims; private Renewing renewing; private Participants participants; - private final List<Element> customContent = new ArrayList<>(); - private final List<JAXBElement<?>> customContentJAXB = new ArrayList<>(); + private final List<Object> customContent = new ArrayList<>(); public Renewing getRenewing() { return renewing; @@ -154,24 +151,14 @@ public class TokenRequirements { this.participants = participants; } - public List<Element> getCustomContent() { + public List<Object> getCustomContent() { return Collections.unmodifiableList(customContent); } - public void addCustomContent(Element customElement) { + public void addCustomContent(Object customElement) { if (customElement != null) { this.customContent.add(customElement); } } - public List<JAXBElement<?>> getCustomContentJAXB() { - return Collections.unmodifiableList(customContentJAXB); - } - - public void addCustomContentJAXB(JAXBElement<?> jaxbElement) { - if (jaxbElement != null) { - this.customContentJAXB.add(jaxbElement); - } - } - } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf/blob/d28828e4/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom/CustomClaimsHandler.java ---------------------------------------------------------------------- diff --git a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom/CustomClaimsHandler.java b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom/CustomClaimsHandler.java index fc43ed8..948aaa9 100644 --- a/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom/CustomClaimsHandler.java +++ b/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/custom/CustomClaimsHandler.java @@ -49,10 +49,14 @@ public class CustomClaimsHandler implements ClaimsHandler { if (claims != null && !claims.isEmpty()) { ProcessedClaimCollection claimCollection = new ProcessedClaimCollection(); - List<Element> customContent = parameters.getTokenRequirements().getCustomContent(); + List<Object> customContent = parameters.getTokenRequirements().getCustomContent(); boolean foundContent = false; if (customContent != null) { - for (Element customContentElement : customContent) { + for (Object customContentObj : customContent) { + if (!(customContentObj instanceof Element)) { + continue; + } + Element customContentElement = (Element)customContentObj; Element realm = XMLUtils.findElement(customContentElement, "realm", "http://cxf.apache.org/custom"); if (realm != null) { String realmStr = realm.getTextContent();
