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 41EE3200C44 for ; Mon, 27 Mar 2017 18:52:20 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 408C3160B85; Mon, 27 Mar 2017 16:52:20 +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 61815160B7B for ; Mon, 27 Mar 2017 18:52:19 +0200 (CEST) Received: (qmail 19038 invoked by uid 500); 27 Mar 2017 16:52:18 -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 19029 invoked by uid 99); 27 Mar 2017 16:52:18 -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; Mon, 27 Mar 2017 16:52:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7B3A4DFE34; Mon, 27 Mar 2017 16:52:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergeyb@apache.org To: commits@cxf.apache.org Message-Id: <87431ee39d3c4edc834c8f95ab8961ed@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: Updating ClineXmlSecInInterceptor, deleting the enc one which is not actually needed Date: Mon, 27 Mar 2017 16:52:18 +0000 (UTC) archived-at: Mon, 27 Mar 2017 16:52:20 -0000 Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 30e2b03d1 -> 449e39521 Updating ClineXmlSecInInterceptor, deleting the enc one which is not actually needed Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/449e3952 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/449e3952 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/449e3952 Branch: refs/heads/3.1.x-fixes Commit: 449e39521d11861c050ea53afe06d27690210e9e Parents: 30e2b03 Author: Sergey Beryozkin Authored: Mon Mar 27 17:47:16 2017 +0100 Committer: Sergey Beryozkin Committed: Mon Mar 27 17:51:58 2017 +0100 ---------------------------------------------------------------------- .../security/xml/ClientXmlEncInInterceptor.java | 36 -------------------- .../security/xml/ClientXmlSecInInterceptor.java | 22 ++++++++---- .../rs/security/xml/XmlSecInInterceptor.java | 21 +++++++----- 3 files changed, 29 insertions(+), 50 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/449e3952/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/ClientXmlEncInInterceptor.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/ClientXmlEncInInterceptor.java b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/ClientXmlEncInInterceptor.java deleted file mode 100644 index 42761f1..0000000 --- a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/ClientXmlEncInInterceptor.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cxf.rs.security.xml; - -import java.io.IOException; - -import javax.ws.rs.client.ClientRequestContext; -import javax.ws.rs.client.ClientResponseContext; -import javax.ws.rs.client.ClientResponseFilter; - -import org.apache.cxf.jaxrs.utils.JAXRSUtils; - -public class ClientXmlEncInInterceptor extends XmlEncInInterceptor implements ClientResponseFilter { - - @Override - public void filter(ClientRequestContext reqCtx, ClientResponseContext respCtx) throws IOException { - handleMessage(JAXRSUtils.getCurrentMessage()); - } - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/449e3952/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/ClientXmlSecInInterceptor.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/ClientXmlSecInInterceptor.java b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/ClientXmlSecInInterceptor.java index f270d1b..cfbc508 100644 --- a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/ClientXmlSecInInterceptor.java +++ b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/ClientXmlSecInInterceptor.java @@ -20,17 +20,27 @@ package org.apache.cxf.rs.security.xml; import java.io.IOException; -import javax.ws.rs.client.ClientRequestContext; -import javax.ws.rs.client.ClientResponseContext; -import javax.ws.rs.client.ClientResponseFilter; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.ext.ReaderInterceptor; +import javax.ws.rs.ext.ReaderInterceptorContext; import org.apache.cxf.jaxrs.utils.JAXRSUtils; +import org.apache.cxf.message.Message; -public class ClientXmlSecInInterceptor extends XmlSecInInterceptor implements ClientResponseFilter { +public class ClientXmlSecInInterceptor extends XmlSecInInterceptor implements ReaderInterceptor { @Override - public void filter(ClientRequestContext reqCtx, ClientResponseContext respCtx) throws IOException { - handleMessage(JAXRSUtils.getCurrentMessage()); + public Object aroundReadFrom(ReaderInterceptorContext ctx) throws IOException, WebApplicationException { + Message message = JAXRSUtils.getCurrentMessage(); + handleMessage(message); + Object object = ctx.proceed(); + new StaxActionInInterceptor(super.isRequireSignature(), + super.isRequireEncryption()).handleMessage(message); + return object; } + @Override + protected void registerStaxActionInInterceptor(Message inMsg) { + // complete + } } http://git-wip-us.apache.org/repos/asf/cxf/blob/449e3952/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java index 98b9eb8..aefecb3 100644 --- a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java +++ b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java @@ -109,10 +109,9 @@ public class XmlSecInInterceptor extends AbstractPhaseInterceptor { originalXmlStreamReader = StaxUtils.createXMLStreamReader(is); } } - - inMsg.getInterceptorChain().add( - new StaxActionInInterceptor(requireSignature, requireEncryption)); - + + registerStaxActionInInterceptor(inMsg); + try { XMLSecurityProperties properties = new XMLSecurityProperties(); configureDecryptionKeys(inMsg, properties); @@ -137,9 +136,15 @@ public class XmlSecInInterceptor extends AbstractPhaseInterceptor { throwFault(e.getMessage(), e); } } - - private void configureDecryptionKeys(Message message, XMLSecurityProperties properties) - throws IOException, + + protected void registerStaxActionInInterceptor(Message inMsg) { + inMsg.getInterceptorChain().add( + new StaxActionInInterceptor(requireSignature, requireEncryption)); + + } + + private void configureDecryptionKeys(Message message, XMLSecurityProperties properties) + throws IOException, UnsupportedCallbackException, WSSecurityException { String cryptoKey = null; String propKey = null; @@ -399,7 +404,7 @@ public class XmlSecInInterceptor extends AbstractPhaseInterceptor { * This interceptor handles parsing the StaX results (events) + checks to see whether the * required (if any) Actions (signature or encryption) were fulfilled. */ - private static class StaxActionInInterceptor extends AbstractPhaseInterceptor { + protected static class StaxActionInInterceptor extends AbstractPhaseInterceptor { private static final Logger LOG = LogUtils.getL7dLogger(StaxActionInInterceptor.class);