cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject [1/2] [CXF-5944] Moving some of code from the jwt package to the jose package
Date Thu, 25 Sep 2014 17:26:46 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 7b330ed0a -> 611629620


http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweEncryption.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweEncryption.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweEncryption.java
index 8a40bc2..446a675 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweEncryption.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweEncryption.java
@@ -18,7 +18,7 @@
  */
 package org.apache.cxf.rs.security.jose.jwe;
 
-import org.apache.cxf.rs.security.jose.jwt.JwtHeadersWriter;
+import org.apache.cxf.rs.security.jose.JoseHeadersWriter;
 
 public class WrappedKeyJweEncryption extends AbstractJweEncryption {
     public WrappedKeyJweEncryption(KeyEncryptionAlgorithm keyEncryptionAlgorithm,
@@ -27,7 +27,7 @@ public class WrappedKeyJweEncryption extends AbstractJweEncryption {
     }
     public WrappedKeyJweEncryption(KeyEncryptionAlgorithm keyEncryptionAlgorithm,
                                    ContentEncryptionAlgorithm contentEncryptionAlgo,
-                                   JwtHeadersWriter writer) {
+                                   JoseHeadersWriter writer) {
         this(new JweHeaders(keyEncryptionAlgorithm.getAlgorithm(), contentEncryptionAlgo.getAlgorithm()), 
              keyEncryptionAlgorithm, contentEncryptionAlgo, writer);
     }
@@ -39,7 +39,7 @@ public class WrappedKeyJweEncryption extends AbstractJweEncryption {
     public WrappedKeyJweEncryption(JweHeaders headers, 
                                    KeyEncryptionAlgorithm keyEncryptionAlgorithm,
                                    ContentEncryptionAlgorithm contentEncryptionAlgo,
-                                   JwtHeadersWriter writer) {
+                                   JoseHeadersWriter writer) {
         super(headers, contentEncryptionAlgo, keyEncryptionAlgorithm, writer);
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/DefaultJwkReaderWriter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/DefaultJwkReaderWriter.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/DefaultJwkReaderWriter.java
index be300f4..fa4f8ba 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/DefaultJwkReaderWriter.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/DefaultJwkReaderWriter.java
@@ -18,12 +18,12 @@
  */
 package org.apache.cxf.rs.security.jose.jwk;
 
-import org.apache.cxf.rs.security.jose.jwt.AbstractJwtObjectReaderWriter;
+import org.apache.cxf.rs.security.jose.AbstractJoseObjectReaderWriter;
 
 
 
 
-public class DefaultJwkReaderWriter extends AbstractJwtObjectReaderWriter
+public class DefaultJwkReaderWriter extends AbstractJoseObjectReaderWriter
     implements JwkReaderWriter {
     @Override
     public String jwkSetToJson(JsonWebKeys jwks) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JsonWebKey.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JsonWebKey.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JsonWebKey.java
index 63c1008..ef594e6 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JsonWebKey.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JsonWebKey.java
@@ -22,21 +22,21 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.rs.security.jose.jwt.AbstractJwtObject;
-import org.apache.cxf.rs.security.jose.jwt.JwtConstants;
+import org.apache.cxf.rs.security.jose.AbstractJoseObject;
+import org.apache.cxf.rs.security.jose.JoseConstants;
 
 
-public class JsonWebKey extends AbstractJwtObject {
+public class JsonWebKey extends AbstractJoseObject {
     
     public static final String KEY_TYPE = "kty";
     public static final String PUBLIC_KEY_USE = "use";
     public static final String KEY_OPERATIONS = "key_ops";
-    public static final String KEY_ALGO = JwtConstants.HEADER_ALGORITHM;
-    public static final String KEY_ID = JwtConstants.HEADER_KEY_ID;
-    public static final String X509_URL = JwtConstants.HEADER_X509_URL;
-    public static final String X509_CHAIN = JwtConstants.HEADER_X509_CHAIN;
-    public static final String X509_THUMBPRINT = JwtConstants.HEADER_X509_THUMBPRINT;
-    public static final String X509_THUMBPRINT_SHA256 = JwtConstants.HEADER_X509_THUMBPRINT_SHA256;
+    public static final String KEY_ALGO = JoseConstants.HEADER_ALGORITHM;
+    public static final String KEY_ID = JoseConstants.HEADER_KEY_ID;
+    public static final String X509_URL = JoseConstants.HEADER_X509_URL;
+    public static final String X509_CHAIN = JoseConstants.HEADER_X509_CHAIN;
+    public static final String X509_THUMBPRINT = JoseConstants.HEADER_X509_THUMBPRINT;
+    public static final String X509_THUMBPRINT_SHA256 = JoseConstants.HEADER_X509_THUMBPRINT_SHA256;
     
     public static final String KEY_TYPE_RSA = "RSA";
     public static final String RSA_MODULUS = "n";

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JsonWebKeys.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JsonWebKeys.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JsonWebKeys.java
index 3c79454..c614622 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JsonWebKeys.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JsonWebKeys.java
@@ -25,9 +25,9 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.rs.security.jose.jwt.AbstractJwtObject;
+import org.apache.cxf.rs.security.jose.AbstractJoseObject;
 
-public class JsonWebKeys extends AbstractJwtObject {
+public class JsonWebKeys extends AbstractJoseObject {
     public static final String KEYS_PROPERTY = "keys";
     public List<JsonWebKey> getKeys() {
         List<?> list = (List<?>)super.getValue(KEYS_PROPERTY);

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/AbstractJwsSignatureProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/AbstractJwsSignatureProvider.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/AbstractJwsSignatureProvider.java
index 4be56f6..e6a7139 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/AbstractJwsSignatureProvider.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/AbstractJwsSignatureProvider.java
@@ -20,8 +20,6 @@ package org.apache.cxf.rs.security.jose.jws;
 
 import java.util.Set;
 
-import org.apache.cxf.rs.security.jose.jwt.JwtHeaders;
-
 public abstract class AbstractJwsSignatureProvider implements JwsSignatureProvider {
     private Set<String> supportedAlgorithms;
     private String algorithm;
@@ -31,9 +29,9 @@ public abstract class AbstractJwsSignatureProvider implements JwsSignatureProvid
         this.algorithm = algo;
     }
     
-    protected JwtHeaders prepareHeaders(JwtHeaders headers) {
+    protected JwsHeaders prepareHeaders(JwsHeaders headers) {
         if (headers == null) {
-            headers = new JwtHeaders();
+            headers = new JwsHeaders();
         }
         String algo = headers.getAlgorithm();
         if (algo != null) {
@@ -49,11 +47,11 @@ public abstract class AbstractJwsSignatureProvider implements JwsSignatureProvid
         return algorithm;    
     }
     @Override
-    public JwsSignature createJwsSignature(JwtHeaders headers) {
+    public JwsSignature createJwsSignature(JwsHeaders headers) {
         return doCreateJwsSignature(prepareHeaders(headers));
     }
     
-    protected abstract JwsSignature doCreateJwsSignature(JwtHeaders headers);
+    protected abstract JwsSignature doCreateJwsSignature(JwsHeaders headers);
     
     protected String checkAlgorithm(String algo) {
         if (algo == null || !supportedAlgorithms.contains(algo)) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/HmacJwsSignatureProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/HmacJwsSignatureProvider.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/HmacJwsSignatureProvider.java
index c1fcc46..77fc1f9 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/HmacJwsSignatureProvider.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/HmacJwsSignatureProvider.java
@@ -27,7 +27,6 @@ import javax.crypto.Mac;
 
 import org.apache.cxf.common.util.Base64Exception;
 import org.apache.cxf.rs.security.jose.jwa.Algorithm;
-import org.apache.cxf.rs.security.jose.jwt.JwtHeaders;
 import org.apache.cxf.rs.security.oauth2.utils.Base64UrlUtility;
 import org.apache.cxf.rs.security.oauth2.utils.crypto.HmacUtils;
 
@@ -56,7 +55,7 @@ public class HmacJwsSignatureProvider extends AbstractJwsSignatureProvider {
         }
     }
     
-    protected JwsSignature doCreateJwsSignature(JwtHeaders headers) {
+    protected JwsSignature doCreateJwsSignature(JwsHeaders headers) {
         final Mac mac = HmacUtils.getInitializedMac(key, Algorithm.toJavaName(headers.getAlgorithm()),
                                                     hmacSpec);
         return new JwsSignature() {

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
index 8c963ec..6b14a1c 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java
@@ -21,16 +21,15 @@ package org.apache.cxf.rs.security.jose.jws;
 import java.io.UnsupportedEncodingException;
 
 import org.apache.cxf.common.util.Base64Exception;
+import org.apache.cxf.rs.security.jose.JoseHeadersReader;
+import org.apache.cxf.rs.security.jose.JoseHeadersReaderWriter;
 import org.apache.cxf.rs.security.jose.jwk.JsonWebKey;
-import org.apache.cxf.rs.security.jose.jwt.JwtHeaders;
-import org.apache.cxf.rs.security.jose.jwt.JwtHeadersReader;
 import org.apache.cxf.rs.security.jose.jwt.JwtTokenReader;
-import org.apache.cxf.rs.security.jose.jwt.JwtTokenReaderWriter;
 import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
 import org.apache.cxf.rs.security.oauth2.utils.Base64UrlUtility;
 
 public class JwsCompactConsumer {
-    private JwtHeadersReader reader = new JwtTokenReaderWriter();
+    private JoseHeadersReader reader = new JoseHeadersReaderWriter();
     private String encodedSequence;
     private String encodedSignature;
     private String headersJson;
@@ -45,7 +44,7 @@ public class JwsCompactConsumer {
     public JwsCompactConsumer(String encodedJws, JwtTokenReader r) {
         this(encodedJws, null, r);
     }
-    public JwsCompactConsumer(String encodedJws, JwsSignatureProperties props, JwtHeadersReader r) {
+    public JwsCompactConsumer(String encodedJws, JwsSignatureProperties props, JoseHeadersReader r) {
         if (r != null) {
             this.reader = r;
         }
@@ -87,12 +86,12 @@ public class JwsCompactConsumer {
     public byte[] getDecodedSignature() {
         return encodedSignature.isEmpty() ? new byte[]{} : decode(encodedSignature);
     }
-    public JwtHeaders getJwtHeaders() {
-        return getReader().fromJsonHeaders(headersJson);
+    public JwsHeaders getJwsHeaders() {
+        return new JwsHeaders(getReader().fromJsonHeaders(headersJson).asMap());
     }
     public boolean verifySignatureWith(JwsSignatureVerifier validator) {
         enforceJweSignatureProperties();
-        if (!validator.verify(getJwtHeaders(), getUnsignedEncodedPayload(), getDecodedSignature())) {
+        if (!validator.verify(getJwsHeaders(), getUnsignedEncodedPayload(), getDecodedSignature())) {
             throw new SecurityException();
         }
         return true;
@@ -113,7 +112,7 @@ public class JwsCompactConsumer {
         }
         
     }
-    protected JwtHeadersReader getReader() {
+    protected JoseHeadersReader getReader() {
         return reader;
     }
     private static byte[] decode(String encoded) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
index 965d3ef..509934b 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsCompactProducer.java
@@ -19,16 +19,15 @@
 package org.apache.cxf.rs.security.jose.jws;
 
 import org.apache.cxf.common.util.StringUtils;
+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.jwk.JsonWebKey;
-import org.apache.cxf.rs.security.jose.jwt.JwtConstants;
-import org.apache.cxf.rs.security.jose.jwt.JwtHeaders;
-import org.apache.cxf.rs.security.jose.jwt.JwtHeadersWriter;
-import org.apache.cxf.rs.security.jose.jwt.JwtTokenReaderWriter;
 import org.apache.cxf.rs.security.oauth2.utils.Base64UrlUtility;
 
 public class JwsCompactProducer {
-    private JwtHeadersWriter writer = new JwtTokenReaderWriter();
-    private JwtHeaders headers;
+    private JoseHeadersWriter writer = new JoseHeadersReaderWriter();
+    private JwsHeaders headers;
     private String plainJwsPayload;
     private String signature;
     private String plainRep;
@@ -36,19 +35,19 @@ public class JwsCompactProducer {
     public JwsCompactProducer(String plainJwsPayload) {
         this(null, null, plainJwsPayload);
     }
-    public JwsCompactProducer(JwtHeaders headers, String plainJwsPayload) {
+    public JwsCompactProducer(JwsHeaders headers, String plainJwsPayload) {
         this(headers, null, plainJwsPayload);
     }
-    public JwsCompactProducer(JwtHeaders headers, JwtHeadersWriter w, String plainJwsPayload) {
+    public JwsCompactProducer(JwsHeaders headers, JoseHeadersWriter w, String plainJwsPayload) {
         this.headers = headers;
         if (w != null) {
             this.writer = w;
         }
         this.plainJwsPayload = plainJwsPayload;
     }
-    public JwtHeaders getHeaders() {
+    public JwsHeaders getHeaders() {
         if (headers == null) {
-            headers = new JwtHeaders();
+            headers = new JwsHeaders();
         }
         return headers;
     }
@@ -101,7 +100,7 @@ public class JwsCompactProducer {
         this.signature = sig;
     }
     private boolean isPlainText() {
-        return JwtConstants.PLAIN_TEXT_ALGO.equals(getAlgorithm());
+        return JoseConstants.PLAIN_TEXT_ALGO.equals(getAlgorithm());
     }
     private String getAlgorithm() {
         return getHeaders().getAlgorithm();

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsHeaders.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsHeaders.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsHeaders.java
new file mode 100644
index 0000000..c8f9460
--- /dev/null
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsHeaders.java
@@ -0,0 +1,32 @@
+/**
+ * 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.jws;
+
+import java.util.Map;
+
+import org.apache.cxf.rs.security.jose.jwt.JwtHeaders;
+
+public class JwsHeaders extends JwtHeaders {
+    public JwsHeaders() {
+    }
+    
+    public JwsHeaders(Map<String, Object> values) {
+        super(values);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJwtCompactProducer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJwtCompactProducer.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJwtCompactProducer.java
index cc227af..19c194d 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJwtCompactProducer.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJwtCompactProducer.java
@@ -39,7 +39,7 @@ public class JwsJwtCompactProducer extends JwsCompactProducer {
         this(new JwtToken(headers, claims), w);
     }
     public JwsJwtCompactProducer(JwtToken token, JwtTokenWriter w) {
-        super(token.getHeaders(), w, serializeClaims(token.getClaims(), w));
+        super(new JwsHeaders(token.getHeaders().asMap()), w, serializeClaims(token.getClaims(), w));
     }
     
     private static String serializeClaims(JwtClaims claims, JwtTokenWriter writer) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsSignatureProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsSignatureProvider.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsSignatureProvider.java
index a4d12bf..010c62e 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsSignatureProvider.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsSignatureProvider.java
@@ -18,9 +18,8 @@
  */
 package org.apache.cxf.rs.security.jose.jws;
 
-import org.apache.cxf.rs.security.jose.jwt.JwtHeaders;
 
 public interface JwsSignatureProvider {
     String getAlgorithm();
-    JwsSignature createJwsSignature(JwtHeaders headers);
+    JwsSignature createJwsSignature(JwsHeaders headers);
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/PrivateKeyJwsSignatureProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/PrivateKeyJwsSignatureProvider.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/PrivateKeyJwsSignatureProvider.java
index bbd92aa..57389eb 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/PrivateKeyJwsSignatureProvider.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jws/PrivateKeyJwsSignatureProvider.java
@@ -28,7 +28,6 @@ import java.util.HashSet;
 import java.util.Set;
 
 import org.apache.cxf.rs.security.jose.jwa.Algorithm;
-import org.apache.cxf.rs.security.jose.jwt.JwtHeaders;
 import org.apache.cxf.rs.security.oauth2.utils.crypto.CryptoUtils;
 
 public class PrivateKeyJwsSignatureProvider extends AbstractJwsSignatureProvider {
@@ -60,7 +59,7 @@ public class PrivateKeyJwsSignatureProvider extends AbstractJwsSignatureProvider
         this.random = random;
         this.signatureSpec = spec;
     }
-    protected JwsSignature doCreateJwsSignature(JwtHeaders headers) {
+    protected JwsSignature doCreateJwsSignature(JwsHeaders headers) {
         final Signature s = CryptoUtils.getSignature(key, 
                                                      Algorithm.toJavaName(headers.getAlgorithm()),
                                                      random,

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/AbstractJwtObject.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/AbstractJwtObject.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/AbstractJwtObject.java
deleted file mode 100644
index e8d45e5..0000000
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/AbstractJwtObject.java
+++ /dev/null
@@ -1,61 +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 java.util.LinkedHashMap;
-import java.util.Map;
-
-public abstract class AbstractJwtObject {
-    protected Map<String, Object> values = new LinkedHashMap<String, Object>();
-    
-    protected AbstractJwtObject() {
-        
-    }
-    
-    protected AbstractJwtObject(Map<String, Object> values) {
-        this.values = values;
-    }
-    
-    protected void setValue(String name, Object value) {
-        values.put(name, value);
-    }
-    
-    protected Object getValue(String name) {
-        return values.get(name);
-    }
-
-    public Map<String, Object> asMap() {
-        return new LinkedHashMap<String, Object>(values);
-    }
-    
-    protected Long getLongDate(String name) {
-        Object object = getValue(name);
-        return object instanceof Long ? (Long)object : Long.valueOf(object.toString());
-    }
-    
-    public int hashCode() { 
-        return values.hashCode();
-    }
-    
-    public boolean equals(Object obj) {
-        return obj instanceof AbstractJwtObject && ((AbstractJwtObject)obj).values.equals(this.values);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/AbstractJwtObjectReaderWriter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/AbstractJwtObjectReaderWriter.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/AbstractJwtObjectReaderWriter.java
deleted file mode 100644
index a70eca7..0000000
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/AbstractJwtObjectReaderWriter.java
+++ /dev/null
@@ -1,212 +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 java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-
-
-public class AbstractJwtObjectReaderWriter {
-    private static final Set<String> DATE_PROPERTIES = 
-        new HashSet<String>(Arrays.asList(JwtConstants.CLAIM_EXPIRY, 
-                                          JwtConstants.CLAIM_ISSUED_AT, 
-                                          JwtConstants.CLAIM_NOT_BEFORE));
-    private boolean format;
-    
-    protected String toJson(AbstractJwtObject jwt) {
-        StringBuilder sb = new StringBuilder();
-        toJsonInternal(sb, jwt.asMap());
-        return sb.toString();
-    }
-
-    protected void toJsonInternal(StringBuilder sb, Map<String, Object> map) {
-        sb.append("{");
-        for (Iterator<Map.Entry<String, Object>> it = map.entrySet().iterator(); it.hasNext();) {
-            Map.Entry<String, Object> entry = it.next();
-            sb.append("\"").append(entry.getKey()).append("\"");
-            sb.append(":");
-            toJsonInternal(sb, entry.getValue(), it.hasNext());
-        }
-        sb.append("}");
-    }
-    
-    protected void toJsonInternal(StringBuilder sb, Object[] array) {
-        toJsonInternal(sb, Arrays.asList(array));
-    }
-    
-    protected void toJsonInternal(StringBuilder sb, Collection<?> coll) {
-        sb.append("[");
-        formatIfNeeded(sb);
-        for (Iterator<?> iter = coll.iterator(); iter.hasNext();) {
-            toJsonInternal(sb, iter.next(), iter.hasNext());
-        }
-        formatIfNeeded(sb);
-        sb.append("]");
-    }
-    
-    @SuppressWarnings("unchecked")
-    protected void toJsonInternal(StringBuilder sb, Object value, boolean hasNext) {
-        if (AbstractJwtObject.class.isAssignableFrom(value.getClass())) {
-            sb.append(toJson((AbstractJwtObject)value));
-        } else if (value.getClass().isArray()) {
-            toJsonInternal(sb, (Object[])value);
-        } else if (Collection.class.isAssignableFrom(value.getClass())) {
-            toJsonInternal(sb, (Collection<?>)value);
-        } else if (Map.class.isAssignableFrom(value.getClass())) {
-            toJsonInternal(sb, (Map<String, Object>)value);
-        } else {
-            if (value.getClass() == String.class) {
-                sb.append("\"");
-            }
-            sb.append(value);
-            if (value.getClass() == String.class) {
-                sb.append("\"");
-            }
-        }
-        if (hasNext) {
-            sb.append(",");
-            formatIfNeeded(sb);
-        }
-        
-    }
-    
-    protected void formatIfNeeded(StringBuilder sb) {
-        if (format) {
-            sb.append("\r\n ");
-        }
-    }
-        
-    protected void fromJsonInternal(AbstractJwtObject jwt, String json) {
-        String theJson = json.trim();
-        Map<String, Object> values = readJwtObjectAsMap(theJson.substring(1, theJson.length() - 1));
-        fromJsonInternal(jwt, values);
-    }
-    
-    protected void fromJsonInternal(AbstractJwtObject jwt, Map<String, Object> values) {
-        for (Map.Entry<String, Object> entry : values.entrySet()) {
-            jwt.setValue(entry.getKey(), entry.getValue());
-        }
-    }
-    
-    protected Map<String, Object> readJwtObjectAsMap(String json) {
-        Map<String, Object> values = new LinkedHashMap<String, Object>();
-        for (int i = 0; i < json.length(); i++) {
-            if (isWhiteSpace(json.charAt(i))) {
-                continue;
-            }
-            
-            int closingQuote = json.indexOf('"', i + 1);
-            int from = json.charAt(i) == '"' ? i + 1 : i;
-            String name = json.substring(from, closingQuote);
-            int sepIndex = json.indexOf(':', closingQuote + 1);
-            
-            int j = 1;
-            while (isWhiteSpace(json.charAt(sepIndex + j))) {
-                j++;
-            }
-            if (json.charAt(sepIndex + j) == '{') {
-                int closingIndex = getClosingIndex(json, '{', '}', sepIndex + j);
-                String newJson = json.substring(sepIndex + j + 1, closingIndex);
-                values.put(name, readJwtObjectAsMap(newJson));
-                i = closingIndex + 1;
-            } else if (json.charAt(sepIndex + j) == '[') {
-                int closingIndex = getClosingIndex(json, '[', ']', sepIndex + j);
-                String newJson = json.substring(sepIndex + j + 1, closingIndex);
-                values.put(name, readJwtObjectAsList(newJson));
-                i = closingIndex + 1;
-            } else {
-                int commaIndex = getCommaIndex(json, sepIndex + j);
-                Object value = readPrimitiveValue(json, sepIndex + j, commaIndex);
-                if (DATE_PROPERTIES.contains(name)) {
-                    value = Long.valueOf(value.toString());
-                }
-                values.put(name, value);
-                i = commaIndex + 1;
-            }
-            
-        }
-        return values;
-    }
-    protected List<Object> readJwtObjectAsList(String json) {
-        List<Object> values = new LinkedList<Object>();
-        for (int i = 0; i < json.length(); i++) {
-            if (isWhiteSpace(json.charAt(i))) {
-                continue;
-            }
-            if (json.charAt(i) == '{') {
-                int closingIndex = getClosingIndex(json, '{', '}', i);
-                values.add(readJwtObjectAsMap(json.substring(i + 1, closingIndex)));
-                i = closingIndex + 1;
-            } else {
-                int commaIndex = getCommaIndex(json, i);
-                Object value = readPrimitiveValue(json, i, commaIndex);
-                values.add(value);
-                i = commaIndex + 1;
-            }
-        }
-        
-        return values;
-    }
-    protected Object readPrimitiveValue(String json, int from, int to) {
-        Object value = json.substring(from, to);
-        String valueStr = value.toString().trim(); 
-        if (valueStr.startsWith("\"")) {
-            value = valueStr.substring(1, valueStr.length() - 1);
-        } else if ("true".equals(value) || "false".equals(value)) {
-            value = Boolean.valueOf(valueStr);
-        } 
-        return value;
-    }
-    
-    protected static int getCommaIndex(String json, int from) {
-        int commaIndex = json.indexOf(",", from);
-        if (commaIndex == -1) {
-            commaIndex = json.length();
-        }
-        return commaIndex;
-    }
-    protected int getClosingIndex(String json, char openChar, char closeChar, int from) {
-        int nextOpenIndex = json.indexOf(openChar, from + 1);
-        int closingIndex = json.indexOf(closeChar, from + 1);
-        while (nextOpenIndex != -1 && nextOpenIndex < closingIndex) {
-            nextOpenIndex = json.indexOf(openChar, closingIndex + 1);
-            closingIndex = json.indexOf(closeChar, closingIndex + 1);
-        }
-        return closingIndex;
-    }
-    protected boolean isWhiteSpace(char jsonChar) {
-        return jsonChar == ' ' || jsonChar == '\r' || jsonChar == '\n' || jsonChar == '\t';
-    }
-
-    public void setFormat(boolean format) {
-        this.format = format;
-    }
-
-    
-
-    
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtClaims.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtClaims.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtClaims.java
index 46644a8..8944e07 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtClaims.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtClaims.java
@@ -21,10 +21,12 @@ package org.apache.cxf.rs.security.jose.jwt;
 
 import java.util.Map;
 
+import org.apache.cxf.rs.security.jose.AbstractJoseObject;
 
 
 
-public class JwtClaims extends AbstractJwtObject {
+
+public class JwtClaims extends AbstractJoseObject {
     
     public JwtClaims() {
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtConstants.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtConstants.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtConstants.java
index e912b31..2f23e2c 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtConstants.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtConstants.java
@@ -20,28 +20,6 @@
 package org.apache.cxf.rs.security.jose.jwt;
 
 public final class JwtConstants {
-    public static final String HEADER_TYPE = "typ";
-    public static final String HEADER_ALGORITHM = "alg";
-    public static final String HEADER_CONTENT_TYPE = "cty";
-    public static final String HEADER_CRITICAL = "crit";
-    
-    public static final String HEADER_KEY_ID = "kid";
-    public static final String HEADER_X509_URL = "x5u";
-    public static final String HEADER_X509_CHAIN = "x5c";
-    public static final String HEADER_X509_THUMBPRINT = "x5t";
-    public static final String HEADER_X509_THUMBPRINT_SHA256 = "x5t#S256";
-    public static final String HEADER_JSON_WEB_KEY = "jwk";
-    public static final String HEADER_JSON_WEB_KEY_SET = "jku";
-    
-    public static final String JWE_HEADER_KEY_ENC_ALGORITHM = HEADER_ALGORITHM;
-    public static final String JWE_HEADER_CONTENT_ENC_ALGORITHM = "enc";
-    public static final String JWE_HEADER_ZIP_ALGORITHM = "zip";
-    public static final String DEFLATE_ZIP_ALGORITHM = "DEF";
-    
-    public static final String TYPE_JWT = "JWT";
-    public static final String TYPE_JOSE = "JOSE";
-    public static final String TYPE_JOSE_JSON = "JOSE+JSON";
-    public static final String MEDIA_TYPE_JOSE_JSON = "application/jose+json";
     
     public static final String CLAIM_ISSUER = "iss";
     public static final String CLAIM_SUBJECT = "sub";
@@ -51,38 +29,7 @@ public final class JwtConstants {
     public static final String CLAIM_ISSUED_AT = "iat";
     public static final String CLAIM_JWT_ID = "jti";
     
-    public static final String PLAIN_TEXT_ALGO = "none";
-    public static final String HMAC_SHA_256_ALGO = "HS256";
-    public static final String HMAC_SHA_384_ALGO = "HS384";
-    public static final String HMAC_SHA_512_ALGO = "HS512";
-    public static final String RS_SHA_256_ALGO = "RS256";
-    public static final String RS_SHA_384_ALGO = "RS384";
-    public static final String RS_SHA_512_ALGO = "RS512";
-    public static final String ES_SHA_256_ALGO = "ES256";
-    public static final String ES_SHA_384_ALGO = "ES384";
-    public static final String ES_SHA_512_ALGO = "ES512";
-    
-    // Key Encryption
-    public static final String RSA_OAEP_ALGO = "RSA-OAEP";
-    public static final String RSA_OAEP_256_ALGO = "RSA-OAEP-256";
-    public static final String RSA_1_5_ALGO = "RSA1_5";
-    public static final String A128KW_ALGO = "A128KW";
-    public static final String A192KW_ALGO = "A192KW";
-    public static final String A256KW_ALGO = "A256KW";
-    public static final String A128GCMKW_ALGO = "A128GCMKW";
-    public static final String A192GCMKW_ALGO = "A192GCMKW";
-    public static final String A256GCMKW_ALGO = "A256GCMKW";
-    public static final String PBES2_HS256_A128KW_ALGO = "PBES2-HS256+A128KW";
-    public static final String PBES2_HS384_A192KW_ALGO = "PBES2-HS384+A192KW";
-    public static final String PBES2_HS512_A256KW_ALGO = "PBES2-HS512+A256KW";
-    // Content Encryption
-    public static final String A128CBC_HS256_ALGO = "A128CBC-HS256";
-    public static final String A192CBC_HS384_ALGO = "A192CBC-HS384";
-    public static final String A256CBC_HS512_ALGO = "A256CBC-HS512";
-    public static final String A128GCM_ALGO = "A128GCM";
-    public static final String A192GCM_ALGO = "A192GCM";
-    public static final String A256GCM_ALGO = "A256GCM";
-    
+        
     private JwtConstants() {
         
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtHeaders.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtHeaders.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtHeaders.java
index b723f7d..e4a1891 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtHeaders.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtHeaders.java
@@ -19,14 +19,13 @@
 
 package org.apache.cxf.rs.security.jose.jwt;
 
-import java.util.List;
 import java.util.Map;
 
-import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.rs.security.jose.JoseConstants;
+import org.apache.cxf.rs.security.jose.JoseHeaders;
 import org.apache.cxf.rs.security.jose.jwa.Algorithm;
-import org.apache.cxf.rs.security.jose.jwk.JsonWebKey;
 
-public class JwtHeaders extends AbstractJwtObject {
+public class JwtHeaders extends JoseHeaders {
     
     public JwtHeaders() {
     }
@@ -43,130 +42,12 @@ public class JwtHeaders extends AbstractJwtObject {
         super(values);
     }
     
-    private void init(String algo) {
-        setType(JwtConstants.TYPE_JWT);
-        this.setAlgorithm(algo);
-    }
-    
-    
-    public void setType(String type) {
-        setHeader(JwtConstants.HEADER_TYPE, type);
-    }
-    
-    public String getType() {
-        return (String)getHeader(JwtConstants.HEADER_TYPE);
-    }
-    
-    public void setContentType(String type) {
-        setHeader(JwtConstants.HEADER_CONTENT_TYPE, type);
-    }
-    
-    public String getContentType() {
-        return (String)getHeader(JwtConstants.HEADER_CONTENT_TYPE);
-    }
-    
-    public void setAlgorithm(String algo) {
-        setHeader(JwtConstants.HEADER_ALGORITHM, algo);
-    }
-    
-    public String getAlgorithm() {
-        return (String)getHeader(JwtConstants.HEADER_ALGORITHM);
-    }
-    
-    public void setKeyId(String kid) {
-        setHeader(JwtConstants.HEADER_KEY_ID, kid);
-    }
-    
-    public String getKeyId() {
-        return (String)getHeader(JwtConstants.HEADER_KEY_ID);
-    }
-    
-    public void setX509Url(String x509Url) {
-        setHeader(JwtConstants.HEADER_X509_URL, x509Url);
-    }
-
-    public String getX509Url() {
-        return (String)getHeader(JwtConstants.HEADER_X509_URL);
-    }
-    
-    public void setX509Chain(String x509Chain) {
-        setHeader(JwtConstants.HEADER_X509_CHAIN, x509Chain);
-    }
-
-    public String getX509Chain() {
-        return (String)getHeader(JwtConstants.HEADER_X509_CHAIN);
+    public JwtHeaders(JoseHeaders headers) {
+        super(headers.asMap());
     }
     
-    public void setX509Thumbprint(String x509Thumbprint) {
-        setHeader(JwtConstants.HEADER_X509_THUMBPRINT, x509Thumbprint);
-    }
-    
-    public String getX509Thumbprint() {
-        return (String)getHeader(JwtConstants.HEADER_X509_THUMBPRINT);
-    }
-    
-    public void setX509ThumbprintSHA256(String x509Thumbprint) {
-        super.setValue(JwtConstants.HEADER_X509_THUMBPRINT_SHA256, x509Thumbprint);
-    }
-    
-    public String getX509ThumbprintSHA256() {
-        return (String)super.getValue(JwtConstants.HEADER_X509_THUMBPRINT_SHA256);
-    }
-    
-    public void setCritical(List<String> crit) {
-        setHeader(JwtConstants.HEADER_CRITICAL, crit);
-    }
-    
-    public List<String> getCritical() {
-        return CastUtils.cast((List<?>)getHeader(JwtConstants.HEADER_CRITICAL));
-    }
-    
-    public void setJsonWebKey(JsonWebKey key) {
-        setValue(JwtConstants.HEADER_JSON_WEB_KEY, key);
-    }
-    
-    public JsonWebKey getJsonWebKey() {
-        Object jsonWebKey = getValue(JwtConstants.HEADER_JSON_WEB_KEY);
-        if (jsonWebKey == null || jsonWebKey instanceof JsonWebKey) {
-            return (JsonWebKey)jsonWebKey;
-        }  
-        Map<String, Object> map = CastUtils.cast((Map<?, ?>)jsonWebKey);
-        return new JsonWebKey(map);
-    }
-    
-    public JwtHeaders setHeader(String name, Object value) {
-        setValue(name, value);
-        return this;
-    }
-    
-    public Object getHeader(String name) {
-        return getValue(name);
-    }
-    
-    public JwtHeaders setIntegerHeader(String name, Integer value) {
-        setValue(name, value);
-        return this;
-    }
-    
-    public Integer getIntegerHeader(String name) {
-        Object value = getValue(name);
-        if (value != null) {
-            return value instanceof Integer ? (Integer)value : Integer.parseInt(value.toString());
-        } else {
-            return null;
-        }
-    }
-    public JwtHeaders setLongHeader(String name, Long value) {
-        setValue(name, value);
-        return this;
-    }
-    
-    public Long getLongHeader(String name) {
-        Object value = getValue(name);
-        if (value != null) {
-            return value instanceof Long ? (Long)value : Long.parseLong(value.toString());
-        } else {
-            return null;
-        }
+    private void init(String algo) {
+        setType(JoseConstants.TYPE_JWT);
+        setAlgorithm(algo);
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtHeadersReader.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtHeadersReader.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtHeadersReader.java
deleted file mode 100644
index 8a15819..0000000
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtHeadersReader.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.jwt;
-
-
-public interface JwtHeadersReader {
-    JwtHeaders fromJsonHeaders(String jsonHeaders);
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtHeadersWriter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtHeadersWriter.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtHeadersWriter.java
deleted file mode 100644
index 6c63dea..0000000
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtHeadersWriter.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;
-
-
-
-public interface JwtHeadersWriter {
-    
-    String headersToJson(JwtHeaders headers);
-    
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReader.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReader.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReader.java
index 2be6305..09a6a5d 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReader.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReader.java
@@ -18,8 +18,10 @@
  */
 package org.apache.cxf.rs.security.jose.jwt;
 
+import org.apache.cxf.rs.security.jose.JoseHeadersReader;
 
-public interface JwtTokenReader extends JwtHeadersReader {
+
+public interface JwtTokenReader extends JoseHeadersReader {
     JwtClaims fromJsonClaims(String jsonClaims);
     JwtToken fromJson(JwtTokenJson jsonPair);
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReaderWriter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReaderWriter.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReaderWriter.java
index c207e0e..d7819e6 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReaderWriter.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenReaderWriter.java
@@ -18,15 +18,14 @@
  */
 package org.apache.cxf.rs.security.jose.jwt;
 
+import org.apache.cxf.rs.security.jose.JoseHeadersReaderWriter;
 
 
 
-public class JwtTokenReaderWriter extends AbstractJwtObjectReaderWriter
+
+public class JwtTokenReaderWriter extends JoseHeadersReaderWriter
     implements JwtTokenReader, JwtTokenWriter {
-    @Override
-    public String headersToJson(JwtHeaders headers) {
-        return toJson(headers);
-    }
+    
 
     @Override
     public String claimsToJson(JwtClaims claims) {
@@ -40,13 +39,6 @@ public class JwtTokenReaderWriter extends AbstractJwtObjectReaderWriter
     }
     
     @Override
-    public JwtHeaders fromJsonHeaders(String headersJson) {
-        JwtHeaders headers = new JwtHeaders();
-        fromJsonInternal(headers, headersJson);
-        return headers;
-    }
-    
-    @Override
     public JwtClaims fromJsonClaims(String claimsJson) {
         JwtClaims claims = new JwtClaims();
         fromJsonInternal(claims, claimsJson);
@@ -55,7 +47,7 @@ public class JwtTokenReaderWriter extends AbstractJwtObjectReaderWriter
     }
     
     private JwtToken fromJson(String headersJson, String claimsJson) {
-        JwtHeaders headers = fromJsonHeaders(headersJson);
+        JwtHeaders headers = new JwtHeaders(fromJsonHeaders(headersJson));
         JwtClaims claims = fromJsonClaims(claimsJson);
         return new JwtToken(headers, claims);
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenWriter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenWriter.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenWriter.java
index bdbd029..a2bd02f 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenWriter.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtTokenWriter.java
@@ -18,9 +18,11 @@
  */
 package org.apache.cxf.rs.security.jose.jwt;
 
+import org.apache.cxf.rs.security.jose.JoseHeadersWriter;
 
 
-public interface JwtTokenWriter extends JwtHeadersWriter {
+
+public interface JwtTokenWriter extends JoseHeadersWriter {
     
     String claimsToJson(JwtClaims claims);
     JwtTokenJson tokenToJson(JwtToken token);

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtUtils.java b/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtUtils.java
deleted file mode 100644
index 6238e2f..0000000
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/main/java/org/apache/cxf/rs/security/jose/jwt/JwtUtils.java
+++ /dev/null
@@ -1,46 +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;
-
-public final class JwtUtils {
-    private JwtUtils() {
-        
-    }
-    
-    public static String checkContentType(String contentType, String defaultType) {
-        if (contentType != null) {
-            int paramIndex = contentType.indexOf(';');
-            String typeWithoutParams = paramIndex == -1 ? contentType : contentType.substring(0, paramIndex);
-            if (typeWithoutParams.indexOf('/') == -1) {
-                contentType = "application/" + contentType;
-            }
-        } else {
-            contentType = defaultType;
-        }
-        return contentType;
-    }
-    public static String expandContentType(String contentType) {
-        int paramIndex = contentType.indexOf(';');
-        String typeWithoutParams = paramIndex == -1 ? contentType : contentType.substring(0, paramIndex);
-        if (typeWithoutParams.indexOf('/') == -1) {
-            contentType = "application/" + contentType;
-        }
-        return contentType;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweCompactReaderWriterTest.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweCompactReaderWriterTest.java b/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweCompactReaderWriterTest.java
index ca49a38..f78b1e9 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweCompactReaderWriterTest.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweCompactReaderWriterTest.java
@@ -25,9 +25,9 @@ import java.security.interfaces.RSAPublicKey;
 import javax.crypto.Cipher;
 import javax.crypto.SecretKey;
 
+import org.apache.cxf.rs.security.jose.JoseConstants;
 import org.apache.cxf.rs.security.jose.jwa.Algorithm;
 import org.apache.cxf.rs.security.jose.jws.JwsCompactReaderWriterTest;
-import org.apache.cxf.rs.security.jose.jwt.JwtConstants;
 import org.apache.cxf.rs.security.oauth2.utils.Base64UrlUtility;
 import org.apache.cxf.rs.security.oauth2.utils.crypto.CryptoUtils;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
@@ -120,13 +120,13 @@ public class JweCompactReaderWriterTest extends Assert {
     public void testEncryptDecryptAesGcmWrapA128CBCHS256() throws Exception {
         final String specPlainText = "Live long and prosper.";
         JweHeaders headers = new JweHeaders();
-        headers.setAlgorithm(JwtConstants.A128GCMKW_ALGO);
+        headers.setAlgorithm(JoseConstants.A128GCMKW_ALGO);
         headers.setContentEncryptionAlgorithm(Algorithm.A128CBC_HS256.getJwtName());
         
         byte[] cekEncryptionKey = Base64UrlUtility.decode(KEY_ENCRYPTION_KEY_A3);
         
         AesGcmWrapKeyEncryptionAlgorithm keyEncryption = 
-            new AesGcmWrapKeyEncryptionAlgorithm(cekEncryptionKey, JwtConstants.A128GCMKW_ALGO);
+            new AesGcmWrapKeyEncryptionAlgorithm(cekEncryptionKey, JoseConstants.A128GCMKW_ALGO);
         JweEncryptionProvider encryption = new AesCbcHmacJweEncryption(headers,
                                                            CONTENT_ENCRYPTION_KEY_A3, 
                                                            INIT_VECTOR_A3,

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JwePbeHmacAesWrapTest.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JwePbeHmacAesWrapTest.java b/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JwePbeHmacAesWrapTest.java
index af5ae37..68177aa 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JwePbeHmacAesWrapTest.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JwePbeHmacAesWrapTest.java
@@ -20,8 +20,8 @@ package org.apache.cxf.rs.security.jose.jwe;
 
 import java.security.Security;
 
+import org.apache.cxf.rs.security.jose.JoseConstants;
 import org.apache.cxf.rs.security.jose.jwa.Algorithm;
-import org.apache.cxf.rs.security.jose.jwt.JwtConstants;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
 
 import org.junit.After;
@@ -42,11 +42,11 @@ public class JwePbeHmacAesWrapTest extends Assert {
     public void testEncryptDecryptPbesHmacAesWrapA128CBCHS256() throws Exception {
         final String specPlainText = "Live long and prosper.";
         JweHeaders headers = new JweHeaders();
-        headers.setAlgorithm(JwtConstants.PBES2_HS256_A128KW_ALGO);
+        headers.setAlgorithm(JoseConstants.PBES2_HS256_A128KW_ALGO);
         headers.setContentEncryptionAlgorithm(Algorithm.A128CBC_HS256.getJwtName());
         final String password = "Thus from my lips, by yours, my sin is purged."; 
         KeyEncryptionAlgorithm keyEncryption = 
-            new PbesHmacAesWrapKeyEncryptionAlgorithm(password, JwtConstants.PBES2_HS256_A128KW_ALGO);
+            new PbesHmacAesWrapKeyEncryptionAlgorithm(password, JoseConstants.PBES2_HS256_A128KW_ALGO);
         JweEncryptionProvider encryption = new AesCbcHmacJweEncryption(headers, keyEncryption);
         String jweContent = encryption.encrypt(specPlainText.getBytes("UTF-8"), null);
         
@@ -60,11 +60,11 @@ public class JwePbeHmacAesWrapTest extends Assert {
     public void testEncryptDecryptPbesHmacAesWrapAesGcm() throws Exception {
         final String specPlainText = "Live long and prosper.";
         JweHeaders headers = new JweHeaders();
-        headers.setAlgorithm(JwtConstants.PBES2_HS256_A128KW_ALGO);
+        headers.setAlgorithm(JoseConstants.PBES2_HS256_A128KW_ALGO);
         headers.setContentEncryptionAlgorithm(Algorithm.A128GCM.getJwtName());
         final String password = "Thus from my lips, by yours, my sin is purged."; 
         KeyEncryptionAlgorithm keyEncryption = 
-            new PbesHmacAesWrapKeyEncryptionAlgorithm(password, JwtConstants.PBES2_HS256_A128KW_ALGO);
+            new PbesHmacAesWrapKeyEncryptionAlgorithm(password, JoseConstants.PBES2_HS256_A128KW_ALGO);
         JweEncryptionProvider encryption = new WrappedKeyJweEncryption(headers, 
                                                                        keyEncryption,
             new AesGcmContentEncryptionAlgorithm(Algorithm.A128GCM.getJwtName()));

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jwk/JsonWebKeyTest.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jwk/JsonWebKeyTest.java b/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jwk/JsonWebKeyTest.java
index d0fadf3..eb660ae 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jwk/JsonWebKeyTest.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jwk/JsonWebKeyTest.java
@@ -24,9 +24,9 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.rs.security.jose.JoseConstants;
 import org.apache.cxf.rs.security.jose.jwa.Algorithm;
 import org.apache.cxf.rs.security.jose.jwe.JweCompactConsumer;
-import org.apache.cxf.rs.security.jose.jwt.JwtConstants;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
 
 import org.junit.Assert;
@@ -173,13 +173,13 @@ public class JsonWebKeyTest extends Assert {
         assertEquals(AES_SECRET_VALUE, key.getProperty(JsonWebKey.OCTET_KEY_VALUE));
         assertEquals(AES_KID_VALUE, key.getKid());
         assertEquals(JsonWebKey.KEY_TYPE_OCTET, key.getKeyType());
-        assertEquals(JwtConstants.A128KW_ALGO, key.getAlgorithm());
+        assertEquals(JoseConstants.A128KW_ALGO, key.getAlgorithm());
     }
     private void validateSecretHmacKey(JsonWebKey key) {
         assertEquals(HMAC_SECRET_VALUE, key.getProperty(JsonWebKey.OCTET_KEY_VALUE));
         assertEquals(HMAC_KID_VALUE, key.getKid());
         assertEquals(JsonWebKey.KEY_TYPE_OCTET, key.getKeyType());
-        assertEquals(JwtConstants.HMAC_SHA_256_ALGO, key.getAlgorithm());
+        assertEquals(JoseConstants.HMAC_SHA_256_ALGO, key.getAlgorithm());
     }
     
     private void validatePublicRsaKey(JsonWebKey key) {
@@ -187,7 +187,7 @@ public class JsonWebKeyTest extends Assert {
         assertEquals(RSA_PUBLIC_EXP_VALUE, key.getProperty(JsonWebKey.RSA_PUBLIC_EXP));
         assertEquals(RSA_KID_VALUE, key.getKid());
         assertEquals(JsonWebKey.KEY_TYPE_RSA, key.getKeyType());
-        assertEquals(JwtConstants.RS_SHA_256_ALGO, key.getAlgorithm());
+        assertEquals(JoseConstants.RS_SHA_256_ALGO, key.getAlgorithm());
     }
     private void validatePrivateRsaKey(JsonWebKey key) {
         validatePublicRsaKey(key);

http://git-wip-us.apache.org/repos/asf/cxf/blob/61162962/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jws/JwsCompactReaderWriterTest.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jws/JwsCompactReaderWriterTest.java b/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jws/JwsCompactReaderWriterTest.java
index 5a08733..a673029 100644
--- a/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jws/JwsCompactReaderWriterTest.java
+++ b/rt/rs/security/oauth-parent/oauth2-jose/src/test/java/org/apache/cxf/rs/security/jose/jws/JwsCompactReaderWriterTest.java
@@ -27,10 +27,10 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.cxf.rs.security.jose.JoseConstants;
 import org.apache.cxf.rs.security.jose.jwa.Algorithm;
 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.JwtConstants;
 import org.apache.cxf.rs.security.jose.jwt.JwtHeaders;
 import org.apache.cxf.rs.security.jose.jwt.JwtToken;
 import org.apache.cxf.rs.security.jose.jwt.JwtTokenReaderWriter;
@@ -102,7 +102,7 @@ public class JwsCompactReaderWriterTest extends Assert {
     
     @Test
     public void testWriteReadJwsUnsigned() throws Exception {
-        JwtHeaders headers = new JwtHeaders(JwtConstants.PLAIN_TEXT_ALGO);
+        JwtHeaders headers = new JwtHeaders(JoseConstants.PLAIN_TEXT_ALGO);
         
         JwtClaims claims = new JwtClaims();
         claims.setIssuer("https://jwt-idp.example.com");
@@ -128,7 +128,7 @@ public class JwsCompactReaderWriterTest extends Assert {
         assertTrue(jws.verifySignatureWith(new HmacJwsSignatureVerifier(ENCODED_MAC_KEY)));
         JwtToken token = jws.getJwtToken();
         JwtHeaders headers = token.getHeaders();
-        assertEquals(JwtConstants.TYPE_JWT, headers.getType());
+        assertEquals(JoseConstants.TYPE_JWT, headers.getType());
         assertEquals(Algorithm.HmacSHA256.getJwtName(), headers.getAlgorithm());
         validateSpecClaim(token.getClaims());
     }
@@ -154,7 +154,7 @@ public class JwsCompactReaderWriterTest extends Assert {
     private void doTestWriteJwsWithJwkSignedByMac(Object jsonWebKey) throws Exception {
         JwtHeaders headers = new JwtHeaders(Algorithm.HmacSHA256.getJwtName());
         
-        headers.setHeader(JwtConstants.HEADER_JSON_WEB_KEY, jsonWebKey);
+        headers.setHeader(JoseConstants.HEADER_JSON_WEB_KEY, jsonWebKey);
         
         JwtClaims claims = new JwtClaims();
         claims.setIssuer("joe");
@@ -174,7 +174,7 @@ public class JwsCompactReaderWriterTest extends Assert {
         assertTrue(jws.verifySignatureWith(new HmacJwsSignatureVerifier(ENCODED_MAC_KEY)));
         JwtToken token = jws.getJwtToken();
         JwtHeaders headers = token.getHeaders();
-        assertEquals(JwtConstants.TYPE_JWT, headers.getType());
+        assertEquals(JoseConstants.TYPE_JWT, headers.getType());
         assertEquals(Algorithm.HmacSHA256.getJwtName(), headers.getAlgorithm());
         
         JsonWebKey key = headers.getJsonWebKey();


Mime
View raw message