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 <sberyoz...@gmail.com>
Authored: Mon Mar 27 17:47:16 2017 +0100
Committer: Sergey Beryozkin <sberyoz...@gmail.com>
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<Message> {
                 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<Message> {
             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<Message> {
      * 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<Message> {
+    protected static class StaxActionInInterceptor extends 
AbstractPhaseInterceptor<Message> {
         
         private static final Logger LOG = 
             LogUtils.getL7dLogger(StaxActionInInterceptor.class);

Reply via email to