Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B804D200C04 for ; Tue, 24 Jan 2017 13:39:01 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id B6A46160B5B; Tue, 24 Jan 2017 12:39:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 12440160B3D for ; Tue, 24 Jan 2017 13:39:00 +0100 (CET) Received: (qmail 96295 invoked by uid 500); 24 Jan 2017 12:39:00 -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 96278 invoked by uid 99); 24 Jan 2017 12:39:00 -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, 24 Jan 2017 12:39:00 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E0598DFC47; Tue, 24 Jan 2017 12:38:59 +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, 24 Jan 2017 12:39:00 -0000 Message-Id: <6a2fdb2552bc46be8806479fc916b517@git.apache.org> In-Reply-To: <5bb73297cf3b483a840bf32b985e430d@git.apache.org> References: <5bb73297cf3b483a840bf32b985e430d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] cxf git commit: Allow custom RST Elements in STS requests archived-at: Tue, 24 Jan 2017 12:39:01 -0000 Allow custom RST Elements in STS requests Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4a021b75 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4a021b75 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4a021b75 Branch: refs/heads/master Commit: 4a021b75c6a604bf46f9e2679563e7b4ab9223bb Parents: a3120a0 Author: Colm O hEigeartaigh Authored: Tue Jan 24 10:45:51 2017 +0000 Committer: Colm O hEigeartaigh Committed: Tue Jan 24 10:45:51 2017 +0000 ---------------------------------------------------------------------- .../apache/cxf/sts/operation/AbstractOperation.java | 10 ++++++++++ .../org/apache/cxf/sts/request/RequestParser.java | 12 ++++++++++++ .../apache/cxf/sts/request/TokenRequirements.java | 16 ++++++++++++++++ 3 files changed, 38 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/4a021b75/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java index b1360b8..4d4dc88 100644 --- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java +++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java @@ -103,7 +103,16 @@ public abstract class AbstractOperation { protected STSEventListener eventPublisher; protected List delegationHandlers = new ArrayList<>(); protected TokenWrapper tokenWrapper = new DefaultTokenWrapper(); + protected boolean allowCustomContent; + public boolean isAllowCustomContent() { + return allowCustomContent; + } + + public void setAllowCustomContent(boolean allowCustomContent) { + this.allowCustomContent = allowCustomContent; + } + public TokenWrapper getTokenWrapper() { return tokenWrapper; } @@ -189,6 +198,7 @@ public abstract class AbstractOperation { stsProperties.configureProperties(); RequestParser requestParser = new RequestParser(); + requestParser.setAllowCustomContent(allowCustomContent); return requestParser.parseRequest(request, messageContext, stsProperties, claimsManager.getClaimParsers()); } http://git-wip-us.apache.org/repos/asf/cxf/blob/4a021b75/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 d3e58d5..2e705fd 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 @@ -95,6 +95,8 @@ public class RequestParser { private static final Logger LOG = LogUtils.getL7dLogger(RequestParser.class); + private boolean allowCustomContent; + public RequestRequirements parseRequest( RequestSecurityTokenType request, Map messageContext, STSPropertiesMBean stsProperties, List claimsParsers @@ -144,6 +146,8 @@ public class RequestParser { || STSConstants.WSP_NS_04.equals(element.getNamespaceURI()))) { tokenRequirements.setAppliesTo(element); LOG.fine("Found AppliesTo element"); + } else if (allowCustomContent) { + tokenRequirements.addCustomContent((Element)requestObject); } else { LOG.log( Level.WARNING, @@ -755,4 +759,12 @@ public class RequestParser { throw new STSException("Cannot retreive token from reference", STSException.REQUEST_FAILED); } + public boolean isAllowCustomContent() { + return allowCustomContent; + } + + public void setAllowCustomContent(boolean allowCustomContent) { + this.allowCustomContent = allowCustomContent; + } + } http://git-wip-us.apache.org/repos/asf/cxf/blob/4a021b75/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 7dd360c..45eab81 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 @@ -18,7 +18,12 @@ */ package org.apache.cxf.sts.request; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + import org.w3c.dom.Element; + import org.apache.cxf.rt.security.claims.ClaimCollection; /** @@ -40,6 +45,7 @@ public class TokenRequirements { private ClaimCollection secondaryClaims; private Renewing renewing; private Participants participants; + private final List customContent = new ArrayList<>(); public Renewing getRenewing() { return renewing; @@ -145,4 +151,14 @@ public class TokenRequirements { this.participants = participants; } + public List getCustomContent() { + return Collections.unmodifiableList(customContent); + } + + public void addCustomContent(Element customElement) { + if (customElement != null) { + this.customContent.add(customElement); + } + } + } \ No newline at end of file