cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Minor updates to JOSE filters
Date Tue, 11 Nov 2014 18:30:53 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 9053b7a86 -> 467a9d933


Minor updates to JOSE filters


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/467a9d93
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/467a9d93
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/467a9d93

Branch: refs/heads/3.0.x-fixes
Commit: 467a9d93355e8e87dc0b47d96499512bcee1b52b
Parents: 9053b7a
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Nov 11 18:28:40 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Nov 11 18:30:35 2014 +0000

----------------------------------------------------------------------
 .../cxf/rs/security/jose/jaxrs/JweWriterInterceptor.java  | 10 ++++++----
 .../cxf/rs/security/jose/jwe/JweCompactProducer.java      |  3 ++-
 .../apache/cxf/rs/security/jose/jwe/JweOutputStream.java  |  5 ++---
 .../cxf/rs/security/jose/jws/JwsJsonOutputStream.java     |  1 +
 .../apache/cxf/rs/security/jose/jws/JwsOutputStream.java  |  1 +
 5 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/467a9d93/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweWriterInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweWriterInterceptor.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweWriterInterceptor.java
index cbe4aef..a50c6a5 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweWriterInterceptor.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweWriterInterceptor.java
@@ -83,16 +83,18 @@ public class JweWriterInterceptor implements WriterInterceptor {
             } catch (IOException ex) {
                 throw new SecurityException(ex);
             }
-            OutputStream jweStream = new JweOutputStream(actualOs, encryption.getCipher(),

+            OutputStream wrappedStream = null;
+            JweOutputStream jweOutputStream = new JweOutputStream(actualOs, encryption.getCipher(),

                                                          encryption.getAuthTagProducer());
+            wrappedStream = jweOutputStream;
             if (encryption.isCompressionSupported()) {
-                jweStream = new DeflaterOutputStream(jweStream);
+                wrappedStream = new DeflaterOutputStream(jweOutputStream);
             }
             
-            ctx.setOutputStream(jweStream);
+            ctx.setOutputStream(wrappedStream);
             ctx.proceed();
             setJoseMediaType(ctx);
-            jweStream.flush();
+            jweOutputStream.finalFlush();
         } else {
             CachedOutputStream cos = new CachedOutputStream(); 
             ctx.setOutputStream(cos);

http://git-wip-us.apache.org/repos/asf/cxf/blob/467a9d93/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweCompactProducer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweCompactProducer.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweCompactProducer.java
index 02b759a..0169fbe 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweCompactProducer.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweCompactProducer.java
@@ -145,7 +145,8 @@ public class JweCompactProducer {
                                          encryptedContentEncryptionKey.length, os);
         os.write(dotBytes);
         Base64UrlUtility.encodeAndStream(cipherInitVector, 0, cipherInitVector.length, os);
-        os.write(dotBytes);         
+        os.write(dotBytes);        
+        os.flush();
     }
     
     public String getJweContent() {

http://git-wip-us.apache.org/repos/asf/cxf/blob/467a9d93/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweOutputStream.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweOutputStream.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweOutputStream.java
index c6462f1..e8faa37 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweOutputStream.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweOutputStream.java
@@ -94,7 +94,7 @@ public class JweOutputStream extends FilterOutputStream {
         }
         int rem = finalWrite ? 0 : lenToEncode % 3; 
         Base64UrlUtility.encodeAndStream(theChunk, off, lenToEncode - rem, out);
-        
+        out.flush();
         if (rem > 0) {
             lastEncryptedDataChunk = newArray(theChunk, lenToEncode - rem, rem);
         } else {
@@ -102,8 +102,7 @@ public class JweOutputStream extends FilterOutputStream {
         }
     }
     
-    @Override
-    public void flush() throws IOException {
+    public void finalFlush() throws IOException {
         if (flushed) {
             return;
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/467a9d93/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonOutputStream.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonOutputStream.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonOutputStream.java
index 7fc1007..85f0356 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonOutputStream.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonOutputStream.java
@@ -68,6 +68,7 @@ public class JwsJsonOutputStream extends FilterOutputStream {
             }
         });
         out.write(b, off, len);
+        out.flush();
     }
     @Override
     public void flush() throws IOException {

http://git-wip-us.apache.org/repos/asf/cxf/blob/467a9d93/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsOutputStream.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsOutputStream.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsOutputStream.java
index f10f30c..b9d572a 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsOutputStream.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsOutputStream.java
@@ -47,6 +47,7 @@ public class JwsOutputStream extends FilterOutputStream {
             throw new SecurityException();
         }
         out.write(b, off, len);
+        out.flush();
     }
     @Override
     public void flush() throws IOException {


Mime
View raw message