You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2014/10/10 14:25:19 UTC

git commit: Updating Jwe/Jws consumers to strip double quotes

Repository: cxf
Updated Branches:
  refs/heads/master 3ba703c34 -> a3d446ae0


Updating Jwe/Jws consumers to strip double quotes


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

Branch: refs/heads/master
Commit: a3d446ae0e90c0916b088c6fed5015a096574a28
Parents: 3ba703c
Author: Sergey Beryozkin <sb...@talend.com>
Authored: Fri Oct 10 13:25:01 2014 +0100
Committer: Sergey Beryozkin <sb...@talend.com>
Committed: Fri Oct 10 13:25:01 2014 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/rs/security/jose/jwe/JweCompactConsumer.java   | 3 +++
 .../org/apache/cxf/rs/security/jose/jws/JwsCompactConsumer.java   | 3 +++
 2 files changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a3d446ae/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 7794102..c2461e3 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
@@ -39,6 +39,9 @@ public class JweCompactConsumer {
         this(jweContent, new JoseHeadersReaderWriter());
     }
     public JweCompactConsumer(String jweContent, JoseHeadersReader reader) {
+        if (jweContent.startsWith("\"") && jweContent.endsWith("\"")) {
+            jweContent = jweContent.substring(1, jweContent.length() - 1);
+        }
         String[] parts = jweContent.split("\\.");
         if (parts.length != 5) {
             throw new SecurityException("5 JWE parts are expected");

http://git-wip-us.apache.org/repos/asf/cxf/blob/a3d446ae/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 f202c36..aa06fcc 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
@@ -40,6 +40,9 @@ public class JwsCompactConsumer {
         if (r != null) {
             this.reader = r;
         }
+        if (encodedJws.startsWith("\"") && encodedJws.endsWith("\"")) {
+            encodedJws = encodedJws.substring(1, encodedJws.length() - 1);
+        }
         String[] parts = encodedJws.split("\\.");
         if (parts.length != 3) {
             if (parts.length == 2 && encodedJws.endsWith(".")) {