cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Updating ClineXmlSecInInterceptor, deleting the enc one which is not actually needed
Date Mon, 27 Mar 2017 16:47:50 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 30cc8717a -> 4e5119b3d


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/4e5119b3
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4e5119b3
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4e5119b3

Branch: refs/heads/master
Commit: 4e5119b3d1d807fb6885ec67ce28180beb55c360
Parents: 30cc871
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Mon Mar 27 17:47:16 2017 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Mon Mar 27 17:47:16 2017 +0100

----------------------------------------------------------------------
 .../security/xml/ClientXmlEncInInterceptor.java | 36 --------------------
 .../security/xml/ClientXmlSecInInterceptor.java | 22 ++++++++----
 .../rs/security/xml/XmlSecInInterceptor.java    | 11 ++++--
 3 files changed, 24 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/4e5119b3/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/4e5119b3/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/4e5119b3/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 d179362..48db383 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
@@ -110,8 +110,7 @@ public class XmlSecInInterceptor extends AbstractPhaseInterceptor<Message>
{
             }
         }
 
-        inMsg.getInterceptorChain().add(
-            new StaxActionInInterceptor(requireSignature, requireEncryption));
+        registerStaxActionInInterceptor(inMsg);
 
         try {
             XMLSecurityProperties properties = new XMLSecurityProperties();
@@ -138,6 +137,12 @@ public class XmlSecInInterceptor extends AbstractPhaseInterceptor<Message>
{
         }
     }
 
+    protected void registerStaxActionInInterceptor(Message inMsg) {
+        inMsg.getInterceptorChain().add(
+            new StaxActionInInterceptor(requireSignature, requireEncryption));
+        
+    }
+
     private void configureDecryptionKeys(Message message, XMLSecurityProperties properties)
         throws IOException,
         UnsupportedCallbackException, WSSecurityException {
@@ -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);


Mime
View raw message