cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Multiple JwsJson entries need to have the same b64 status
Date Tue, 15 Sep 2015 15:06:56 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 6e67ffc60 -> 6f8e682a9


Multiple JwsJson entries need to have the same b64 status


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

Branch: refs/heads/master
Commit: 6f8e682a9b8d27613f68b47de8d120f6846dc783
Parents: 6e67ffc
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Tue Sep 15 16:06:29 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Tue Sep 15 16:06:29 2015 +0100

----------------------------------------------------------------------
 .../apache/cxf/rs/security/jose/jws/JwsJsonConsumer.java    | 9 +--------
 .../apache/cxf/rs/security/jose/jws/JwsJsonProducer.java    | 9 ++++-----
 2 files changed, 5 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/6f8e682a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonConsumer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonConsumer.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonConsumer.java
index d1ca673..f03e0e5 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonConsumer.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonConsumer.java
@@ -41,7 +41,6 @@ public class JwsJsonConsumer {
     private String jwsSignedDocument;
     private String jwsPayload;
     private List<JwsJsonSignatureEntry> signatures = new LinkedList<JwsJsonSignatureEntry>();
-    private boolean detached;
     /**
      * @param jwsSignedDocument
      *            signed JWS Document
@@ -70,7 +69,6 @@ public class JwsJsonConsumer {
             LOG.warning("JSON JWS has no payload");
             throw new JwsException(JwsException.Error.INVALID_JSON_JWS);
         }
-        detached = detachedPayload != null;
         List<Map<String, Object>> signatureArray = CastUtils.cast((List<?>)jsonObjectMap.get("signatures"));
         if (signatureArray != null) {
             if (jsonObjectMap.containsKey("signature")) {
@@ -92,12 +90,7 @@ public class JwsJsonConsumer {
         
     }
     private Boolean validateB64Status() {
-        if (!detached) {
-            return JwsJsonProducer.validateb64Status(signatures);    
-        } else {
-            return Boolean.TRUE;
-        }
-        
+        return JwsJsonProducer.validateB64Status(signatures);    
     }
     protected JwsJsonSignatureEntry getSignatureObject(Map<String, Object> signatureEntry)
{
         String protectedHeader = (String)signatureEntry.get("protected");

http://git-wip-us.apache.org/repos/asf/cxf/blob/6f8e682a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonProducer.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonProducer.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonProducer.java
index 554f340..acb6475 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonProducer.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jws/JwsJsonProducer.java
@@ -67,10 +67,12 @@ public class JwsJsonProducer {
         if (signatures.isEmpty()) { 
             return null;
         }
+        
+        Boolean b64Status = validateB64Status(signatures);
         StringBuilder sb = new StringBuilder();
         sb.append("{");
         if (!detached) {
-            sb.append("\"payload\":\"" + getActualPayload() + "\"");
+            sb.append("\"payload\":\"" + getActualPayload(b64Status) + "\"");
             sb.append(",");
         }
         if (!supportFlattened || signatures.size() > 1) {
@@ -89,9 +91,6 @@ public class JwsJsonProducer {
         sb.append("}");
         return sb.toString();
     }
-    private String getActualPayload() {
-        return getActualPayload(validateb64Status(signatures));
-    }
     public List<JwsJsonSignatureEntry> getSignatureEntries() {
         return signatures;
     }
@@ -192,7 +191,7 @@ public class JwsJsonProducer {
             }
         }
     }
-    static Boolean validateb64Status(List<JwsJsonSignatureEntry> signatures) {
+    static Boolean validateB64Status(List<JwsJsonSignatureEntry> signatures) {
         Set<Boolean> b64Set = new LinkedHashSet<Boolean>();
         for (JwsJsonSignatureEntry entry : signatures) {
             JwsHeaders headers = entry.getProtectedHeader();


Mime
View raw message