cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6085] Completing the preparation work
Date Fri, 06 Feb 2015 21:07:20 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 60b084a58 -> 589ee44b9


[CXF-6085] Completing the preparation work


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

Branch: refs/heads/3.0.x-fixes
Commit: 589ee44b9282db826b22a89f005b966bef124694
Parents: 60b084a
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Fri Feb 6 21:05:58 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Fri Feb 6 21:06:59 2015 +0000

----------------------------------------------------------------------
 .../cxf/rs/security/jose/jwe/AbstractJweEncryption.java  | 11 ++++++++++-
 .../org/apache/cxf/rs/security/jose/jwe/JweHeaders.java  |  9 +++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/589ee44b/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 66d0a51..9103ecf 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
@@ -137,6 +137,7 @@ public abstract class AbstractJweEncryption implements JweEncryptionProvider
{
         }
         theHeaders.setContentEncryptionAlgorithm(getContentAlgorithm());
         
+        JweHeaders protectedHeaders = null;
         if (jweHeaders != null) {
             if (jweHeaders.getKeyEncryptionAlgorithm() != null 
                 && (getKeyAlgorithm() == null 
@@ -146,6 +147,14 @@ public abstract class AbstractJweEncryption implements JweEncryptionProvider
{
                 throw new SecurityException();
             }
             theHeaders.asMap().putAll(jweHeaders.asMap());
+            if (jweHeaders.getProtectedHeaders() != null 
+                && !jweHeaders.asMap().entrySet().containsAll(theHeaders.asMap().entrySet()))
{
+                jweHeaders.getProtectedHeaders().asMap().putAll(theHeaders.asMap());
+            }
+            protectedHeaders = jweHeaders.getProtectedHeaders() != null 
+                ? jweHeaders.getProtectedHeaders() : theHeaders;
+        } else {
+            protectedHeaders = theHeaders;
         }
         
         
@@ -161,7 +170,7 @@ public abstract class AbstractJweEncryption implements JweEncryptionProvider
{
         byte[] jweContentEncryptionKey = 
             getEncryptedContentEncryptionKey(theHeaders, theCek);
         
-        JweHeaders protectedHeaders = theHeaders;
+        
         String protectedHeadersJson = writer.headersToJson(protectedHeaders);
         
         byte[] additionalEncryptionParam = getAAD(protectedHeadersJson, aad);

http://git-wip-us.apache.org/repos/asf/cxf/blob/589ee44b/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 f049ffb..ead32de 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
@@ -31,6 +31,7 @@ import org.apache.cxf.rs.security.jose.JoseHeadersReaderWriter;
 
 
 public class JweHeaders extends JoseHeaders {
+    private JweHeaders protectedHeaders;
     public JweHeaders() {
     }
     
@@ -99,4 +100,12 @@ public class JweHeaders extends JoseHeaders {
         String base64UrlHeadersInJson = Base64UrlUtility.encode(headerBytes);
         return StringUtils.toBytesASCII(base64UrlHeadersInJson);
     }
+
+    public JweHeaders getProtectedHeaders() {
+        return protectedHeaders;
+    }
+
+    public void setProtectedHeaders(JweHeaders protectedHeaders) {
+        this.protectedHeaders = protectedHeaders;
+    }
 }


Mime
View raw message