cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Removing Jose interfaces for supporting using 3rd party JSON libraries as there's no obvious need in it, can be reviewed and done better if needed in the future; simplifying the code along the way
Date Thu, 15 Jan 2015 17:19:05 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 99c7c309e -> bdcc48de5


Removing Jose interfaces for supporting using 3rd party JSON libraries as there's no obvious need in it, can be reviewed and done better if needed in the future; simplifying the code along the way


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

Branch: refs/heads/master
Commit: bdcc48de55e679318f23ab9a0645b4d32fc298bd
Parents: 99c7c30
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Thu Jan 15 17:18:42 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Thu Jan 15 17:18:42 2015 +0000

----------------------------------------------------------------------
 .../cxf/rs/security/jose/JoseHeadersReader.java | 24 -----------
 .../security/jose/JoseHeadersReaderWriter.java  |  5 +--
 .../cxf/rs/security/jose/JoseHeadersWriter.java | 25 ------------
 .../jose/jaxrs/JweWriterInterceptor.java        |  8 ----
 .../jose/jaxrs/JwsWriterInterceptor.java        |  6 +--
 .../jose/jwe/AbstractJweDecryption.java         | 11 +----
 .../jose/jwe/AbstractJweEncryption.java         | 22 ++--------
 .../jose/jwe/AesCbcHmacJweDecryption.java       |  9 +---
 .../jose/jwe/AesCbcHmacJweEncryption.java       | 10 +----
 .../jose/jwe/DirectKeyJweDecryption.java        | 17 ++------
 .../jose/jwe/EcdhDirectKeyJweDecryption.java    |  3 +-
 .../security/jose/jwe/JweCompactConsumer.java   |  5 +--
 .../security/jose/jwe/JweCompactProducer.java   | 43 ++++----------------
 .../cxf/rs/security/jose/jwe/JweHeaders.java    |  6 +--
 .../jose/jwe/JweJwtCompactProducer.java         |  2 +-
 .../jose/jwe/WrappedKeyJweDecryption.java       |  8 +---
 .../jose/jwe/WrappedKeyJweEncryption.java       | 16 +-------
 .../security/jose/jws/JwsCompactConsumer.java   | 13 +++---
 .../security/jose/jws/JwsCompactProducer.java   |  5 +--
 .../jose/jws/JwsJwtCompactConsumer.java         |  6 +--
 .../jose/jws/JwsJwtCompactProducer.java         |  9 ++--
 .../rs/security/jose/jwt/JwtTokenReader.java    | 27 ------------
 .../security/jose/jwt/JwtTokenReaderWriter.java |  8 +---
 .../rs/security/jose/jwt/JwtTokenWriter.java    | 30 --------------
 .../cxf/rs/security/jose/jwt/JwtUtils.java      | 12 ++----
 .../jose/jws/JwsCompactReaderWriterTest.java    |  3 +-
 .../grants/jwt/JwtBearerGrantHandler.java       | 11 +----
 27 files changed, 51 insertions(+), 293 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseHeadersReader.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseHeadersReader.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseHeadersReader.java
deleted file mode 100644
index a99ca23..0000000
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseHeadersReader.java
+++ /dev/null
@@ -1,24 +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.jose;
-
-
-public interface JoseHeadersReader {
-    JoseHeaders fromJsonHeaders(String jsonHeaders);
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseHeadersReaderWriter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseHeadersReaderWriter.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseHeadersReaderWriter.java
index abcdf8f..37a0aa5 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseHeadersReaderWriter.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseHeadersReaderWriter.java
@@ -24,14 +24,11 @@ import org.apache.cxf.jaxrs.provider.json.JsonMapObjectReaderWriter;
 
 
 
-public class JoseHeadersReaderWriter extends JsonMapObjectReaderWriter
-    implements JoseHeadersReader, JoseHeadersWriter {
-    @Override
+public class JoseHeadersReaderWriter extends JsonMapObjectReaderWriter {
     public String headersToJson(JoseHeaders headers) {
         return toJson(headers);
     }
     
-    @Override
     public JoseHeaders fromJsonHeaders(String headersJson) {
         JoseHeaders headers = new JoseHeaders();
         fromJson(headers, headersJson);

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseHeadersWriter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseHeadersWriter.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseHeadersWriter.java
deleted file mode 100644
index 54a77e7..0000000
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/JoseHeadersWriter.java
+++ /dev/null
@@ -1,25 +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.jose;
-
-public interface JoseHeadersWriter {
-    
-    String headersToJson(JoseHeaders headers);
-    
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/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 f762541..cc28c63 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
@@ -35,8 +35,6 @@ import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.rs.security.jose.JoseConstants;
-import org.apache.cxf.rs.security.jose.JoseHeadersReaderWriter;
-import org.apache.cxf.rs.security.jose.JoseHeadersWriter;
 import org.apache.cxf.rs.security.jose.jwe.JweCompactProducer;
 import org.apache.cxf.rs.security.jose.jwe.JweEncryptionProvider;
 import org.apache.cxf.rs.security.jose.jwe.JweEncryptionState;
@@ -49,7 +47,6 @@ public class JweWriterInterceptor implements WriterInterceptor {
     private JweEncryptionProvider encryptionProvider;
     private boolean contentTypeRequired = true;
     private boolean useJweOutputStream;
-    private JoseHeadersWriter writer = new JoseHeadersReaderWriter();
     @Override
     public void aroundWriteTo(WriterInterceptorContext ctx) throws IOException, WebApplicationException {
         if (ctx.getEntity() == null) {
@@ -75,7 +72,6 @@ public class JweWriterInterceptor implements WriterInterceptor {
             try {
                 JweCompactProducer.startJweContent(actualOs,
                                                    encryption.getHeaders(), 
-                                                   writer, 
                                                    encryption.getContentEncryptionKey(), 
                                                    encryption.getIv());
             } catch (IOException ex) {
@@ -121,10 +117,6 @@ public class JweWriterInterceptor implements WriterInterceptor {
         this.useJweOutputStream = useJweOutputStream;
     }
 
-    public void setWriter(JoseHeadersWriter writer) {
-        this.writer = writer;
-    }
-
     public void setEncryptionProvider(JweEncryptionProvider encryptionProvider) {
         this.encryptionProvider = encryptionProvider;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JwsWriterInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JwsWriterInterceptor.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JwsWriterInterceptor.java
index 44eb42f..10b43f1 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JwsWriterInterceptor.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JwsWriterInterceptor.java
@@ -35,7 +35,6 @@ import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.rs.security.jose.JoseConstants;
 import org.apache.cxf.rs.security.jose.JoseHeaders;
 import org.apache.cxf.rs.security.jose.JoseHeadersReaderWriter;
-import org.apache.cxf.rs.security.jose.JoseHeadersWriter;
 import org.apache.cxf.rs.security.jose.jws.JwsCompactProducer;
 import org.apache.cxf.rs.security.jose.jws.JwsOutputStream;
 import org.apache.cxf.rs.security.jose.jws.JwsSignature;
@@ -45,7 +44,7 @@ import org.apache.cxf.rs.security.jose.jws.JwsSignatureProvider;
 public class JwsWriterInterceptor extends AbstractJwsWriterProvider implements WriterInterceptor {
     private boolean contentTypeRequired = true;
     private boolean useJwsOutputStream;
-    private JoseHeadersWriter writer = new JoseHeadersReaderWriter();
+    private JoseHeadersReaderWriter writer = new JoseHeadersReaderWriter();
     @Override
     public void aroundWriteTo(WriterInterceptorContext ctx) throws IOException, WebApplicationException {
         if (ctx.getEntity() == null) {
@@ -86,9 +85,6 @@ public class JwsWriterInterceptor extends AbstractJwsWriterProvider implements W
     public void setUseJwsOutputStream(boolean useJwsOutputStream) {
         this.useJwsOutputStream = useJwsOutputStream;
     }
-    public void setWriter(JoseHeadersWriter writer) {
-        this.writer = writer;
-    }
     private void setContentTypeIfNeeded(JoseHeaders headers, WriterInterceptorContext ctx) {    
         if (contentTypeRequired) {
             MediaType mt = ctx.getMediaType();

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractJweDecryption.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractJweDecryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractJweDecryption.java
index ae525c7..a00feaa 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractJweDecryption.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractJweDecryption.java
@@ -24,20 +24,13 @@ import java.security.spec.AlgorithmParameterSpec;
 import org.apache.cxf.common.util.crypto.CryptoUtils;
 import org.apache.cxf.common.util.crypto.KeyProperties;
 import org.apache.cxf.rs.security.jose.JoseConstants;
-import org.apache.cxf.rs.security.jose.JoseHeadersReader;
-import org.apache.cxf.rs.security.jose.JoseHeadersReaderWriter;
 import org.apache.cxf.rs.security.jose.jwa.Algorithm;
 
 public abstract class AbstractJweDecryption implements JweDecryptionProvider {
     private KeyDecryptionAlgorithm keyDecryptionAlgo;
     private ContentDecryptionAlgorithm contentDecryptionAlgo;
-    private JoseHeadersReader reader = new JoseHeadersReaderWriter();
-    protected AbstractJweDecryption(JoseHeadersReader theReader,
-                                    KeyDecryptionAlgorithm keyDecryptionAlgo,
+    protected AbstractJweDecryption(KeyDecryptionAlgorithm keyDecryptionAlgo,
                                     ContentDecryptionAlgorithm contentDecryptionAlgo) {
-        if (theReader != null) {
-            reader = theReader;
-        }
         this.keyDecryptionAlgo = keyDecryptionAlgo;
         this.contentDecryptionAlgo = contentDecryptionAlgo;
     }
@@ -47,7 +40,7 @@ public abstract class AbstractJweDecryption implements JweDecryptionProvider {
     }
     
     public JweDecryptionOutput decrypt(String content) {
-        JweCompactConsumer consumer = new JweCompactConsumer(content, reader);
+        JweCompactConsumer consumer = new JweCompactConsumer(content);
         return doDecrypt(consumer);
     }
     public byte[] decrypt(JweCompactConsumer consumer) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractJweEncryption.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractJweEncryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractJweEncryption.java
index 02db4e0..03ef462 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractJweEncryption.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AbstractJweEncryption.java
@@ -27,30 +27,18 @@ import org.apache.cxf.common.util.crypto.CryptoUtils;
 import org.apache.cxf.common.util.crypto.KeyProperties;
 import org.apache.cxf.rs.security.jose.JoseConstants;
 import org.apache.cxf.rs.security.jose.JoseHeadersReaderWriter;
-import org.apache.cxf.rs.security.jose.JoseHeadersWriter;
 import org.apache.cxf.rs.security.jose.jwa.Algorithm;
 
 public abstract class AbstractJweEncryption implements JweEncryptionProvider {
     protected static final int DEFAULT_AUTH_TAG_LENGTH = 128;
     private JweHeaders headers;
-    private JoseHeadersWriter writer;
     private ContentEncryptionAlgorithm contentEncryptionAlgo;
     private KeyEncryptionAlgorithm keyEncryptionAlgo;
-    
+    private JoseHeadersReaderWriter writer = new JoseHeadersReaderWriter();
     protected AbstractJweEncryption(JweHeaders headers, 
                                     ContentEncryptionAlgorithm contentEncryptionAlgo,
                                     KeyEncryptionAlgorithm keyEncryptionAlgo) {
-        this(headers, contentEncryptionAlgo, keyEncryptionAlgo, null);
-    }
-    protected AbstractJweEncryption(JweHeaders headers, 
-                                    ContentEncryptionAlgorithm contentEncryptionAlgo, 
-                                    KeyEncryptionAlgorithm keyEncryptionAlgo,
-                                    JoseHeadersWriter writer) {
         this.headers = headers;
-        this.writer = writer;
-        if (this.writer == null) {
-            this.writer = new JoseHeadersReaderWriter();
-        }
         this.keyEncryptionAlgo = keyEncryptionAlgo;
         this.contentEncryptionAlgo = contentEncryptionAlgo;
     }
@@ -105,16 +93,11 @@ public abstract class AbstractJweEncryption implements JweEncryptionProvider {
     
     protected JweCompactProducer getJweCompactProducer(JweEncryptionInternal state, byte[] cipher) {
         return new JweCompactProducer(state.theHeaders, 
-                                      getJwtHeadersWriter(),                
                                       state.jweContentEncryptionKey,
                                       state.theIv,
                                       cipher,
                                       DEFAULT_AUTH_TAG_LENGTH);
     }
-    
-    protected JoseHeadersWriter getJwtHeadersWriter() {
-        return writer;
-    }
     protected JweHeaders getJweHeaders() {
         return headers;
     }
@@ -126,6 +109,9 @@ public abstract class AbstractJweEncryption implements JweEncryptionProvider {
     public String getContentAlgorithm() {
         return getContentEncryptionAlgorithm().getAlgorithm();
     }
+    protected JoseHeadersReaderWriter getJwtHeadersWriter() {
+        return writer;
+    }
     @Override
     public JweEncryptionState createJweEncryptionState(JweHeaders jweHeaders) {
         JweEncryptionInternal state = getInternalState(jweHeaders);

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesCbcHmacJweDecryption.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesCbcHmacJweDecryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesCbcHmacJweDecryption.java
index 0ef6580..84a9fdd 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesCbcHmacJweDecryption.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesCbcHmacJweDecryption.java
@@ -23,7 +23,6 @@ import java.util.Arrays;
 
 import javax.crypto.spec.IvParameterSpec;
 
-import org.apache.cxf.rs.security.jose.JoseHeadersReader;
 import org.apache.cxf.rs.security.jose.jwa.Algorithm;
 
 public class AesCbcHmacJweDecryption extends AbstractJweDecryption {
@@ -31,13 +30,9 @@ public class AesCbcHmacJweDecryption extends AbstractJweDecryption {
     public AesCbcHmacJweDecryption(KeyDecryptionAlgorithm keyDecryptionAlgo) {
         this(keyDecryptionAlgo, null);
     }
-    public AesCbcHmacJweDecryption(KeyDecryptionAlgorithm keyDecryptionAlgo, String supportedAlgo) {
-        this(keyDecryptionAlgo, supportedAlgo, null);
-    }
     public AesCbcHmacJweDecryption(KeyDecryptionAlgorithm keyDecryptionAlgo,
-                                   String supportedAlgo,
-                                   JoseHeadersReader reader) {
-        super(reader, keyDecryptionAlgo, new AesCbcContentDecryptionAlgorithm(supportedAlgo));
+                                   String supportedAlgo) {
+        super(keyDecryptionAlgo, new AesCbcContentDecryptionAlgorithm(supportedAlgo));
         this.supportedAlgo = supportedAlgo;
     }
     protected JweDecryptionOutput doDecrypt(JweCompactConsumer consumer, byte[] cek) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesCbcHmacJweEncryption.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesCbcHmacJweEncryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesCbcHmacJweEncryption.java
index ab0220c..6613625 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesCbcHmacJweEncryption.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesCbcHmacJweEncryption.java
@@ -27,7 +27,6 @@ import javax.crypto.Mac;
 import javax.crypto.spec.IvParameterSpec;
 
 import org.apache.cxf.common.util.crypto.HmacUtils;
-import org.apache.cxf.rs.security.jose.JoseHeadersWriter;
 import org.apache.cxf.rs.security.jose.jwa.Algorithm;
 
 public class AesCbcHmacJweEncryption extends AbstractJweEncryption {
@@ -55,17 +54,10 @@ public class AesCbcHmacJweEncryption extends AbstractJweEncryption {
     }
     public AesCbcHmacJweEncryption(JweHeaders headers, byte[] cek, 
                                    byte[] iv, KeyEncryptionAlgorithm keyEncryptionAlgorithm) {
-        this(headers, cek, iv, keyEncryptionAlgorithm, null);
-    }
-    public AesCbcHmacJweEncryption(JweHeaders headers, 
-                                   byte[] cek, 
-                                   byte[] iv, 
-                                   KeyEncryptionAlgorithm keyEncryptionAlgorithm,
-                                   JoseHeadersWriter writer) {
         super(headers, 
               new AesCbcContentEncryptionAlgorithm(cek, iv, 
                                                    validateCekAlgorithm(headers.getContentEncryptionAlgorithm())),
-              keyEncryptionAlgorithm, writer);
+              keyEncryptionAlgorithm);
         
     }
     @Override

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweDecryption.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweDecryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweDecryption.java
index cd351ef..e57ee32 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweDecryption.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweDecryption.java
@@ -20,24 +20,15 @@ package org.apache.cxf.rs.security.jose.jwe;
 
 import java.security.Key;
 
-import org.apache.cxf.rs.security.jose.JoseHeadersReader;
-
 public class DirectKeyJweDecryption extends AbstractJweDecryption {
     public DirectKeyJweDecryption(Key contentDecryptionKey, 
-                                  ContentDecryptionAlgorithm cipherProps) {
-        this(contentDecryptionKey, null, cipherProps);
-    }
-    public DirectKeyJweDecryption(Key contentDecryptionKey, 
-                                  JoseHeadersReader reader,
                                   ContentDecryptionAlgorithm cipherProps) {    
-        this(reader, 
-              new DirectKeyDecryptionAlgorithm(contentDecryptionKey),
-              cipherProps);
+        this(new DirectKeyDecryptionAlgorithm(contentDecryptionKey),
+             cipherProps);
     }
-    protected DirectKeyJweDecryption(JoseHeadersReader reader,
-                                     DirectKeyDecryptionAlgorithm direct,
+    protected DirectKeyJweDecryption(DirectKeyDecryptionAlgorithm direct,
                                      ContentDecryptionAlgorithm cipherProps) {    
-        super(reader, direct, cipherProps);
+        super(direct, cipherProps);
     }
     protected static class DirectKeyDecryptionAlgorithm implements KeyDecryptionAlgorithm {
         private byte[] contentDecryptionKey;

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhDirectKeyJweDecryption.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhDirectKeyJweDecryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhDirectKeyJweDecryption.java
index 688ecfa..37049ea 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhDirectKeyJweDecryption.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhDirectKeyJweDecryption.java
@@ -28,8 +28,7 @@ import org.apache.cxf.rs.security.jose.jwk.JwkUtils;
 
 public class EcdhDirectKeyJweDecryption extends DirectKeyJweDecryption {
     public EcdhDirectKeyJweDecryption(ECPrivateKey privateKey, String supportedCtAlgo) {
-        super(null, 
-              new EcdhDirectKeyDecryptionAlgorithm(privateKey), 
+        super(new EcdhDirectKeyDecryptionAlgorithm(privateKey), 
               new AesGcmContentDecryptionAlgorithm(supportedCtAlgo));
     }
     protected static byte[] getDecryptedContentEncryptionKeyFromHeaders(JweHeaders headers,

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweCompactConsumer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweCompactConsumer.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweCompactConsumer.java
index 5862072..fb7be1a 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweCompactConsumer.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweCompactConsumer.java
@@ -24,7 +24,6 @@ import java.io.UnsupportedEncodingException;
 import org.apache.cxf.common.util.Base64Exception;
 import org.apache.cxf.common.util.Base64UrlUtility;
 import org.apache.cxf.rs.security.jose.JoseHeaders;
-import org.apache.cxf.rs.security.jose.JoseHeadersReader;
 import org.apache.cxf.rs.security.jose.JoseHeadersReaderWriter;
 
 
@@ -36,9 +35,6 @@ public class JweCompactConsumer {
     private byte[] authTag;
     private JweHeaders jweHeaders;
     public JweCompactConsumer(String jweContent) {
-        this(jweContent, new JoseHeadersReaderWriter());
-    }
-    public JweCompactConsumer(String jweContent, JoseHeadersReader reader) {
         if (jweContent.startsWith("\"") && jweContent.endsWith("\"")) {
             jweContent = jweContent.substring(1, jweContent.length() - 1);
         }
@@ -53,6 +49,7 @@ public class JweCompactConsumer {
             
             encryptedContent = Base64UrlUtility.decode(parts[3]);
             authTag = Base64UrlUtility.decode(parts[4]);
+            JoseHeadersReaderWriter reader = new JoseHeadersReaderWriter();
             JoseHeaders joseHeaders = reader.fromJsonHeaders(headersJson);
             if (joseHeaders.getUpdateCount() != null) { 
                 throw new SecurityException("Duplicate headers have been detected");

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/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 0169fbe..a261d54 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
@@ -25,8 +25,6 @@ import java.io.OutputStream;
 import org.apache.cxf.common.util.Base64UrlUtility;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.rs.security.jose.JoseHeadersReaderWriter;
-import org.apache.cxf.rs.security.jose.JoseHeadersWriter;
-import org.apache.cxf.rs.security.jose.jwt.JwtTokenReaderWriter;
 
 
 public class JweCompactProducer {
@@ -38,22 +36,10 @@ public class JweCompactProducer {
                        byte[] cipherInitVector,
                        byte[] encryptedContentNoTag,
                        byte[] authenticationTag) {    
-        this(headers, null, encryptedContentEncryptionKey, 
+        this(getHeadersJson(headers), encryptedContentEncryptionKey, 
              cipherInitVector, encryptedContentNoTag, authenticationTag);
     }
     
-    public JweCompactProducer(JweHeaders headers,
-                       JoseHeadersWriter writer,
-                       byte[] encryptedContentEncryptionKey,
-                       byte[] cipherInitVector,
-                       byte[] encryptedContentNoTag,
-                       byte[] authenticationTag) {
-        this(getHeadersJson(headers, writer),
-             encryptedContentEncryptionKey,
-             cipherInitVector,
-             encryptedContentNoTag,
-             authenticationTag);
-    }
     public JweCompactProducer(String headersJson,
                               byte[] encryptedContentEncryptionKey,
                               byte[] cipherInitVector,
@@ -71,16 +57,7 @@ public class JweCompactProducer {
                        byte[] cipherInitVector,
                        byte[] encryptedContentWithTag,
                        int authTagLengthBits) {    
-        this(headers, null, encryptedContentEncryptionKey, 
-             cipherInitVector, encryptedContentWithTag, authTagLengthBits);
-    }
-    public JweCompactProducer(JweHeaders headers,
-                       JoseHeadersWriter writer,
-                       byte[] encryptedContentEncryptionKey,
-                       byte[] cipherInitVector,
-                       byte[] encryptedContentWithTag,
-                       int authTagLengthBits) {
-        jweContentBuilder = startJweContent(new StringBuilder(), headers, writer,
+        jweContentBuilder = startJweContent(new StringBuilder(), headers, 
                                    encryptedContentEncryptionKey, cipherInitVector);
         this.encodedEncryptedContent = Base64UrlUtility.encodeChunk(
             encryptedContentWithTag, 
@@ -93,26 +70,22 @@ public class JweCompactProducer {
         
     }
     public static String startJweContent(JweHeaders headers,
-                                                JoseHeadersWriter writer, 
                                                 byte[] encryptedContentEncryptionKey,
                                                 byte[] cipherInitVector) {
         return startJweContent(new StringBuilder(), 
-                               headers, writer, encryptedContentEncryptionKey, cipherInitVector).toString();       
+                               headers, encryptedContentEncryptionKey, cipherInitVector).toString();       
     }
     public static StringBuilder startJweContent(StringBuilder sb,
                                         JweHeaders headers,
-                                        JoseHeadersWriter writer, 
                                         byte[] encryptedContentEncryptionKey,
                                         byte[] cipherInitVector) {
         return startJweContent(sb, 
-                               getHeadersJson(headers, writer), 
+                               getHeadersJson(headers), 
                                encryptedContentEncryptionKey, 
                                cipherInitVector);
     }
-    private static String getHeadersJson(JweHeaders headers,
-                                         JoseHeadersWriter writer) {
-        writer = writer == null ? new JoseHeadersReaderWriter() : writer;
-        return writer.headersToJson(headers);
+    private static String getHeadersJson(JweHeaders headers) {
+        return new JoseHeadersReaderWriter().headersToJson(headers);
         
     }
     public static StringBuilder startJweContent(StringBuilder sb,
@@ -133,11 +106,9 @@ public class JweCompactProducer {
     
     public static void startJweContent(OutputStream os,
                                        JweHeaders headers,
-                                       JoseHeadersWriter writer, 
                                        byte[] encryptedContentEncryptionKey,
                                        byte[] cipherInitVector) throws IOException {
-        writer = writer == null ? new JwtTokenReaderWriter() : writer;
-        byte[] jsonBytes = StringUtils.toBytesUTF8(writer.headersToJson(headers));
+        byte[] jsonBytes = StringUtils.toBytesUTF8(getHeadersJson(headers));
         Base64UrlUtility.encodeAndStream(jsonBytes, 0, jsonBytes.length, os);
         byte[] dotBytes = new byte[]{'.'};
         os.write(dotBytes);

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweHeaders.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweHeaders.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweHeaders.java
index e3373ee..7b0ce21 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweHeaders.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweHeaders.java
@@ -25,7 +25,7 @@ import org.apache.cxf.common.util.Base64UrlUtility;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.rs.security.jose.JoseConstants;
 import org.apache.cxf.rs.security.jose.JoseHeaders;
-import org.apache.cxf.rs.security.jose.JoseHeadersWriter;
+import org.apache.cxf.rs.security.jose.JoseHeadersReaderWriter;
 
 
 
@@ -92,8 +92,8 @@ public class JweHeaders extends JoseHeaders {
     public JoseHeaders setHeader(String name, Object value) {
         return (JoseHeaders)super.setHeader(name, value);
     }
-    public byte[] toCipherAdditionalAuthData(JoseHeadersWriter writer) { 
-        return toCipherAdditionalAuthData(writer.headersToJson(this));
+    public byte[] toCipherAdditionalAuthData() { 
+        return toCipherAdditionalAuthData(new JoseHeadersReaderWriter().headersToJson(this));
     }
     public static byte[] toCipherAdditionalAuthData(String headersJson) { 
         byte[] headerBytes = StringUtils.toBytesUTF8(headersJson);

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweJwtCompactProducer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweJwtCompactProducer.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweJwtCompactProducer.java
index f0ce331..ad4ad08 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweJwtCompactProducer.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweJwtCompactProducer.java
@@ -40,7 +40,7 @@ public class JweJwtCompactProducer  {
     }
     public JweJwtCompactProducer(JoseHeaders joseHeaders, JwtClaims claims) {
         headers = new JweHeaders(joseHeaders);
-        claimsJson = JwtUtils.claimsToJson(claims, null);
+        claimsJson = JwtUtils.claimsToJson(claims);
     }
     
     public String encryptWith(JsonWebKey key) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweDecryption.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweDecryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweDecryption.java
index c74e880..4944151 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweDecryption.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweDecryption.java
@@ -18,17 +18,11 @@
  */
 package org.apache.cxf.rs.security.jose.jwe;
 
-import org.apache.cxf.rs.security.jose.JoseHeadersReader;
 
 public class WrappedKeyJweDecryption extends AbstractJweDecryption {
     
     public WrappedKeyJweDecryption(KeyDecryptionAlgorithm keyDecryptionAlgo,
-                                   ContentDecryptionAlgorithm contentDecryptionAlgo) {    
-        this(keyDecryptionAlgo, null, contentDecryptionAlgo);
-    }
-    public WrappedKeyJweDecryption(KeyDecryptionAlgorithm keyDecryptionAlgo,
-                                   JoseHeadersReader reader,
                                    ContentDecryptionAlgorithm cipherProps) {    
-        super(reader, keyDecryptionAlgo, cipherProps);
+        super(keyDecryptionAlgo, cipherProps);
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweEncryption.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweEncryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweEncryption.java
index 446a675..ff34730 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweEncryption.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweEncryption.java
@@ -18,29 +18,17 @@
  */
 package org.apache.cxf.rs.security.jose.jwe;
 
-import org.apache.cxf.rs.security.jose.JoseHeadersWriter;
 
 public class WrappedKeyJweEncryption extends AbstractJweEncryption {
     public WrappedKeyJweEncryption(KeyEncryptionAlgorithm keyEncryptionAlgorithm,
                                    ContentEncryptionAlgorithm contentEncryptionAlgo) {
-        this(keyEncryptionAlgorithm, contentEncryptionAlgo, null);
-    }
-    public WrappedKeyJweEncryption(KeyEncryptionAlgorithm keyEncryptionAlgorithm,
-                                   ContentEncryptionAlgorithm contentEncryptionAlgo,
-                                   JoseHeadersWriter writer) {
         this(new JweHeaders(keyEncryptionAlgorithm.getAlgorithm(), contentEncryptionAlgo.getAlgorithm()), 
-             keyEncryptionAlgorithm, contentEncryptionAlgo, writer);
+             keyEncryptionAlgorithm, contentEncryptionAlgo);
     }
     public WrappedKeyJweEncryption(JweHeaders headers, 
                                    KeyEncryptionAlgorithm keyEncryptionAlgorithm,
                                    ContentEncryptionAlgorithm contentEncryptionAlgo) {
-        this(headers, keyEncryptionAlgorithm, contentEncryptionAlgo, null);
-    }
-    public WrappedKeyJweEncryption(JweHeaders headers, 
-                                   KeyEncryptionAlgorithm keyEncryptionAlgorithm,
-                                   ContentEncryptionAlgorithm contentEncryptionAlgo,
-                                   JoseHeadersWriter writer) {
-        super(headers, contentEncryptionAlgo, keyEncryptionAlgorithm, writer);
+        super(headers, contentEncryptionAlgo, keyEncryptionAlgorithm);
     }
     
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
index 3ab2841..5ca4861 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
@@ -22,24 +22,23 @@ import java.security.interfaces.RSAPublicKey;
 
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.rs.security.jose.JoseHeaders;
-import org.apache.cxf.rs.security.jose.JoseHeadersReader;
 import org.apache.cxf.rs.security.jose.JoseHeadersReaderWriter;
 import org.apache.cxf.rs.security.jose.JoseUtils;
 import org.apache.cxf.rs.security.jose.jwk.JsonWebKey;
 
 public class JwsCompactConsumer {
-    private JoseHeadersReader reader = new JoseHeadersReaderWriter();
+    private JoseHeadersReaderWriter reader = new JoseHeadersReaderWriter();
     private String encodedSequence;
     private String encodedSignature;
     private String headersJson;
     private String decodedJwsPayload;
     public JwsCompactConsumer(String encodedJws) {
-        this(encodedJws, null);
+        this(encodedJws, null, null);
     }
-    public JwsCompactConsumer(String encodedJws, JoseHeadersReader r) {
-        this(encodedJws, null, r);
+    public JwsCompactConsumer(String encodedJws, String encodedDetachedPayload) {
+        this(encodedJws, encodedDetachedPayload, null);
     }
-    public JwsCompactConsumer(String encodedJws, String encodedDetachedPayload, JoseHeadersReader r) {
+    protected JwsCompactConsumer(String encodedJws, String encodedDetachedPayload, JoseHeadersReaderWriter r) {
         if (r != null) {
             this.reader = r;
         }
@@ -114,7 +113,7 @@ public class JwsCompactConsumer {
     public boolean validateCriticalHeaders() {
         return JwsUtils.validateCriticalHeaders(getJoseHeaders());
     }
-    protected JoseHeadersReader getReader() {
+    protected JoseHeadersReaderWriter getReader() {
         return reader;
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
index 53fdf7a..fa4674e 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
@@ -25,11 +25,10 @@ import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.rs.security.jose.JoseConstants;
 import org.apache.cxf.rs.security.jose.JoseHeaders;
 import org.apache.cxf.rs.security.jose.JoseHeadersReaderWriter;
-import org.apache.cxf.rs.security.jose.JoseHeadersWriter;
 import org.apache.cxf.rs.security.jose.jwk.JsonWebKey;
 
 public class JwsCompactProducer {
-    private JoseHeadersWriter writer = new JoseHeadersReaderWriter();
+    private JoseHeadersReaderWriter writer = new JoseHeadersReaderWriter();
     private JoseHeaders headers;
     private String plainJwsPayload;
     private String signature;
@@ -40,7 +39,7 @@ public class JwsCompactProducer {
     public JwsCompactProducer(JoseHeaders headers, String plainJwsPayload) {
         this(headers, null, plainJwsPayload);
     }
-    public JwsCompactProducer(JoseHeaders headers, JoseHeadersWriter w, String plainJwsPayload) {
+    protected JwsCompactProducer(JoseHeaders headers, JoseHeadersReaderWriter w, String plainJwsPayload) {
         this.headers = headers;
         if (w != null) {
             this.writer = w;

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJwtCompactConsumer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJwtCompactConsumer.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJwtCompactConsumer.java
index 61138af..cfa6e39 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJwtCompactConsumer.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJwtCompactConsumer.java
@@ -21,16 +21,12 @@ package org.apache.cxf.rs.security.jose.jws;
 import org.apache.cxf.rs.security.jose.jwt.JwtClaims;
 import org.apache.cxf.rs.security.jose.jwt.JwtToken;
 import org.apache.cxf.rs.security.jose.jwt.JwtTokenJson;
-import org.apache.cxf.rs.security.jose.jwt.JwtTokenReader;
 import org.apache.cxf.rs.security.jose.jwt.JwtTokenReaderWriter;
 
 public class JwsJwtCompactConsumer extends JwsCompactConsumer {
     private JwtToken token;
     public JwsJwtCompactConsumer(String encodedJws) {
-        this(encodedJws, null);
-    }
-    public JwsJwtCompactConsumer(String encodedJws, JwtTokenReader r) {
-        super(encodedJws, r == null ? new JwtTokenReaderWriter() : r);
+        super(encodedJws, null, new JwtTokenReaderWriter());
     }
     public JwtTokenJson getDecodedJsonToken() {
         return new JwtTokenJson(getDecodedJsonHeaders(), getDecodedJwsPayload());

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJwtCompactProducer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJwtCompactProducer.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJwtCompactProducer.java
index cbfc64c..12df35c 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJwtCompactProducer.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJwtCompactProducer.java
@@ -20,7 +20,7 @@ package org.apache.cxf.rs.security.jose.jws;
 import org.apache.cxf.rs.security.jose.JoseHeaders;
 import org.apache.cxf.rs.security.jose.jwt.JwtClaims;
 import org.apache.cxf.rs.security.jose.jwt.JwtToken;
-import org.apache.cxf.rs.security.jose.jwt.JwtTokenWriter;
+import org.apache.cxf.rs.security.jose.jwt.JwtTokenReaderWriter;
 import org.apache.cxf.rs.security.jose.jwt.JwtUtils;
 
 
@@ -33,12 +33,9 @@ public class JwsJwtCompactProducer extends JwsCompactProducer {
         this(new JwtToken(null, claims), null);
     }
     public JwsJwtCompactProducer(JoseHeaders headers, JwtClaims claims) {
-        this(headers, claims, null);
+        this(new JwtToken(headers, claims), null);
     }
-    public JwsJwtCompactProducer(JoseHeaders headers, JwtClaims claims, JwtTokenWriter w) {
-        this(new JwtToken(headers, claims), w);
-    }
-    public JwsJwtCompactProducer(JwtToken token, JwtTokenWriter w) {
+    protected JwsJwtCompactProducer(JwtToken token, JwtTokenReaderWriter w) {
         super(token.getHeaders(), w, JwtUtils.claimsToJson(token.getClaims(), w));
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReader.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReader.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReader.java
deleted file mode 100644
index 09a6a5d..0000000
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReader.java
+++ /dev/null
@@ -1,27 +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.jose.jwt;
-
-import org.apache.cxf.rs.security.jose.JoseHeadersReader;
-
-
-public interface JwtTokenReader extends JoseHeadersReader {
-    JwtClaims fromJsonClaims(String jsonClaims);
-    JwtToken fromJson(JwtTokenJson jsonPair);
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReaderWriter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReaderWriter.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReaderWriter.java
index 344d8f1..42cc004 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReaderWriter.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReaderWriter.java
@@ -28,25 +28,22 @@ import org.apache.cxf.rs.security.jose.JoseHeadersReaderWriter;
 
 
 
-public class JwtTokenReaderWriter extends JoseHeadersReaderWriter
-    implements JwtTokenReader, JwtTokenWriter {
+public class JwtTokenReaderWriter extends JoseHeadersReaderWriter {
     private static final Set<String> DATE_PROPERTIES = 
         new HashSet<String>(Arrays.asList(JwtConstants.CLAIM_EXPIRY, 
                                           JwtConstants.CLAIM_ISSUED_AT, 
                                           JwtConstants.CLAIM_NOT_BEFORE));
 
-    @Override
     public String claimsToJson(JwtClaims claims) {
         return toJson(claims);
     }
 
-    @Override
     public JwtTokenJson tokenToJson(JwtToken token) {
         return new JwtTokenJson(toJson(token.getHeaders()),
                                     toJson(token.getClaims()));
     }
     
-    @Override
+    
     public JwtClaims fromJsonClaims(String claimsJson) {
         JwtClaims claims = new JwtClaims();
         fromJson(claims, claimsJson);
@@ -60,7 +57,6 @@ public class JwtTokenReaderWriter extends JoseHeadersReaderWriter
         return new JwtToken(headers, claims);
     }
     
-    @Override
     public JwtToken fromJson(JwtTokenJson pair) {
         return fromJson(pair.getHeadersJson(), pair.getClaimsJson());
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenWriter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenWriter.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenWriter.java
deleted file mode 100644
index a2bd02f..0000000
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenWriter.java
+++ /dev/null
@@ -1,30 +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.jose.jwt;
-
-import org.apache.cxf.rs.security.jose.JoseHeadersWriter;
-
-
-
-public interface JwtTokenWriter extends JoseHeadersWriter {
-    
-    String claimsToJson(JwtClaims claims);
-    JwtTokenJson tokenToJson(JwtToken token);
-    
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtUtils.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtUtils.java
index 6b620de..d78fc41 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtUtils.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtUtils.java
@@ -24,22 +24,16 @@ public final class JwtUtils {
         
     }
     public static String claimsToJson(JwtClaims claims) {
-        return claimsToJson(claims);
+        return claimsToJson(claims, null);
     }
-    public static String claimsToJson(JwtClaims claims, JwtTokenWriter writer) {
+    public static String claimsToJson(JwtClaims claims, JwtTokenReaderWriter writer) {
         if (writer == null) {
             writer = new JwtTokenReaderWriter();
         }
         return writer.claimsToJson(claims);
     }
     public static JwtClaims jsonToClaims(String json) {
-        return jsonToClaims(json, null);
-    }
-    public static JwtClaims jsonToClaims(String json, JwtTokenReader reader) {
-        if (reader == null) {
-            reader = new JwtTokenReaderWriter();
-        }
-        return reader.fromJsonClaims(json);
+        return new JwtTokenReaderWriter().fromJsonClaims(json);
     }
     
     public static void validateJwtTimeClaims(JwtClaims claims, int issuedAtRange, boolean claimsRequired) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jws/JwsCompactReaderWriterTest.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jws/JwsCompactReaderWriterTest.java b/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jws/JwsCompactReaderWriterTest.java
index df709d6..bdf4067 100644
--- a/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jws/JwsCompactReaderWriterTest.java
+++ b/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jws/JwsCompactReaderWriterTest.java
@@ -36,7 +36,6 @@ import org.apache.cxf.rs.security.jose.jwk.JsonWebKey;
 import org.apache.cxf.rs.security.jose.jwt.JwtClaims;
 import org.apache.cxf.rs.security.jose.jwt.JwtToken;
 import org.apache.cxf.rs.security.jose.jwt.JwtTokenReaderWriter;
-import org.apache.cxf.rs.security.jose.jwt.JwtTokenWriter;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
 
 import org.junit.Assert;
@@ -282,7 +281,7 @@ public class JwsCompactReaderWriterTest extends Assert {
     }
 
     
-    private JwtTokenWriter getWriter() {
+    private JwtTokenReaderWriter getWriter() {
         JwtTokenReaderWriter jsonWriter = new JwtTokenReaderWriter();
         jsonWriter.setFormat(true);
         return jsonWriter;

http://git-wip-us.apache.org/repos/asf/cxf/blob/bdcc48de/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/jwt/JwtBearerGrantHandler.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/jwt/JwtBearerGrantHandler.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/jwt/JwtBearerGrantHandler.java
index d0fc0fa..8d52d2e 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/jwt/JwtBearerGrantHandler.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/grants/jwt/JwtBearerGrantHandler.java
@@ -25,7 +25,6 @@ import javax.ws.rs.core.MultivaluedMap;
 import org.apache.cxf.jaxrs.utils.HttpUtils;
 import org.apache.cxf.rs.security.jose.jws.JwsJwtCompactConsumer;
 import org.apache.cxf.rs.security.jose.jwt.JwtToken;
-import org.apache.cxf.rs.security.jose.jwt.JwtTokenReader;
 import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
 import org.apache.cxf.rs.security.oauth2.common.UserSubject;
@@ -44,7 +43,6 @@ public class JwtBearerGrantHandler extends AbstractJwtHandler {
         // and encoded grant type value will help
         ENCODED_JWT_BEARER_GRANT = HttpUtils.urlEncode(Constants.JWT_BEARER_GRANT, "UTF-8");
     }
-    private JwtTokenReader jwtReader;
     public JwtBearerGrantHandler() {
         super(Arrays.asList(Constants.JWT_BEARER_GRANT, ENCODED_JWT_BEARER_GRANT));
     }
@@ -80,12 +78,7 @@ public class JwtBearerGrantHandler extends AbstractJwtHandler {
     }
 
     protected JwsJwtCompactConsumer getJwsReader(String assertion) {
-        return new JwsJwtCompactConsumer(assertion, jwtReader);
+        return new JwsJwtCompactConsumer(assertion);
     }
-    
-    public void setJwtReader(JwtTokenReader tokenReader) {
-        this.jwtReader = tokenReader;
-    }
-
-    
+        
 }


Mime
View raw message