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 2017/03/01 13:10:52 UTC

cxf git commit: [CXF-6725] Removing old and likely never used JWE properties

Repository: cxf
Updated Branches:
  refs/heads/master ad200706d -> d187ef6f3


[CXF-6725] Removing old and likely never used JWE properties


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

Branch: refs/heads/master
Commit: d187ef6f3906d867a8c30a991d9074d170bca487
Parents: ad20070
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Wed Mar 1 13:10:39 2017 +0000
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Wed Mar 1 13:10:39 2017 +0000

----------------------------------------------------------------------
 .../rs/security/jose/common/JoseConstants.java  | 19 --------
 .../cxf/rs/security/jose/jwe/JweUtils.java      | 46 +++++---------------
 2 files changed, 11 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/d187ef6f/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseConstants.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseConstants.java b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseConstants.java
index 6d516ef..6abbd5f 100644
--- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseConstants.java
+++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/JoseConstants.java
@@ -190,36 +190,17 @@ public final class JoseConstants {
     public static final String RSSEC_ENCRYPTION_CONTENT_ALGORITHM = "rs.security.encryption.content.algorithm";
 
     /**
-     * The OLD encryption content algorithm to use. Use RSSEC_ENCRYPTION_CONTENT_ALGORITHM instead.
-     */
-    @Deprecated
-    public static final String DEPR_RSSEC_ENCRYPTION_CONTENT_ALGORITHM =
-        "rs.security.jwe.content.encryption.algorithm";
-
-    /**
      * The encryption key algorithm to use. The default algorithm if not specified is 'RSA-OAEP' if the key is an
      * RSA key, and 'A128GCMKW' if it is an octet sequence.
      */
     public static final String RSSEC_ENCRYPTION_KEY_ALGORITHM = "rs.security.encryption.key.algorithm";
 
     /**
-     * The OLD encryption key algorithm to use. Use RSSEC_ENCRYPTION_KEY_ALGORITHM instead.
-     */
-    @Deprecated
-    public static final String DEPR_RSSEC_ENCRYPTION_KEY_ALGORITHM = "rs.security.jwe.key.encryption.algorithm";
-
-    /**
      * The encryption zip algorithm to use.
      */
     public static final String RSSEC_ENCRYPTION_ZIP_ALGORITHM = "rs.security.encryption.zip.algorithm";
 
     /**
-     * The OLD encryption zip algorithm to use. Use RSSEC_ENCRYPTION_ZIP_ALGORITHM instead.
-     */
-    @Deprecated
-    public static final String DEPR_RSSEC_ENCRYPTION_ZIP_ALGORITHM = "rs.security.jwe.zip.algorithm";
-
-    /**
      * The encryption properties file for encryption creation. If not specified then it falls back to
      * RSSEC_ENCRYPTION_PROPS.
      */

http://git-wip-us.apache.org/repos/asf/cxf/blob/d187ef6f/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java
index fce4f7e..715d05b 100644
--- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java
+++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java
@@ -314,7 +314,6 @@ public final class JweUtils {
         return loadEncryptionProvider(props, headers, required);
     }
 
-    @SuppressWarnings("deprecation")
     public static JweEncryptionProvider loadEncryptionProvider(Properties props, JweHeaders headers, boolean required) {
         Message m = PhaseInterceptorChain.getCurrentMessage();
 
@@ -382,9 +381,6 @@ public final class JweUtils {
         }
 
         String compression = props.getProperty(JoseConstants.RSSEC_ENCRYPTION_ZIP_ALGORITHM);
-        if (compression == null) {
-            compression = props.getProperty(JoseConstants.DEPR_RSSEC_ENCRYPTION_ZIP_ALGORITHM);
-        }
         return createJweEncryptionProvider(keyEncryptionProvider,
                                     ctEncryptionProvider,
                                     contentAlgo.getJwaName(),
@@ -734,7 +730,6 @@ public final class JweUtils {
             return getDirectKeyJweDecryption(ctDecryptionKey, contentDecryptionAlgo);
         }
     }
-    @SuppressWarnings("deprecation")
     public static KeyAlgorithm getKeyEncryptionAlgorithm(Message m, Properties props,
                                                    KeyAlgorithm algo, KeyAlgorithm defaultAlgo) {
         if (algo == null) {
@@ -742,27 +737,15 @@ public final class JweUtils {
                 defaultAlgo = KeyAlgorithm.RSA_OAEP;
             }
 
-            // Check for deprecated identifier first
-            String encAlgo = null;
-            if (props != null) {
-                encAlgo = props.getProperty(JoseConstants.DEPR_RSSEC_ENCRYPTION_KEY_ALGORITHM);
-            }
-            if (encAlgo == null && m != null) {
-                encAlgo = (String)m.getContextualProperty(JoseConstants.DEPR_RSSEC_ENCRYPTION_KEY_ALGORITHM);
-            }
-            if (encAlgo != null) {
-                return KeyAlgorithm.getAlgorithm(encAlgo);
-            }
-
-            // Otherwise check newer identifier
-            if (props != null) {
-                return getKeyEncryptionAlgorithm(props, defaultAlgo);
-            }
+            algo = getKeyEncryptionAlgorithm(m, props, defaultAlgo);
         }
         return algo;
     }
     public static KeyAlgorithm getKeyEncryptionAlgorithm(Properties props, KeyAlgorithm defaultAlgo) {
-        String algo = KeyManagementUtils.getKeyAlgorithm(PhaseInterceptorChain.getCurrentMessage(),
+        return getKeyEncryptionAlgorithm(PhaseInterceptorChain.getCurrentMessage(), props, defaultAlgo);
+    }
+    public static KeyAlgorithm getKeyEncryptionAlgorithm(Message m, Properties props, KeyAlgorithm defaultAlgo) {    
+        String algo = KeyManagementUtils.getKeyAlgorithm(m,
                                                   props,
                                                   JoseConstants.RSSEC_ENCRYPTION_KEY_ALGORITHM,
                                                   defaultAlgo == null ? null : defaultAlgo.getJwaName());
@@ -776,29 +759,22 @@ public final class JweUtils {
             return KeyAlgorithm.RSA_OAEP;
         }
     }
-    @SuppressWarnings("deprecation")
     public static ContentAlgorithm getContentEncryptionAlgorithm(Message m,
                                                        Properties props,
                                                        ContentAlgorithm algo,
                                                        ContentAlgorithm defaultAlgo) {
         if (algo == null) {
-            // Check for deprecated identifier first
-            String encAlgo = props.getProperty(JoseConstants.DEPR_RSSEC_ENCRYPTION_CONTENT_ALGORITHM);
-            if (encAlgo == null && m != null) {
-                encAlgo = (String)m.getContextualProperty(JoseConstants.DEPR_RSSEC_ENCRYPTION_CONTENT_ALGORITHM);
-            }
-            if (encAlgo != null) {
-                return ContentAlgorithm.getAlgorithm(encAlgo);
-            }
-
-            return getContentEncryptionAlgorithm(props, defaultAlgo);
+            algo = getContentEncryptionAlgorithm(m, props, defaultAlgo);
         }
         return algo;
     }
-
     public static ContentAlgorithm getContentEncryptionAlgorithm(Properties props,
                                                                  ContentAlgorithm defaultAlgo) {
-        String algo = KeyManagementUtils.getKeyAlgorithm(PhaseInterceptorChain.getCurrentMessage(),
+        return getContentEncryptionAlgorithm(PhaseInterceptorChain.getCurrentMessage(), props, defaultAlgo);
+    }
+    public static ContentAlgorithm getContentEncryptionAlgorithm(Message m, Properties props,
+                                                                 ContentAlgorithm defaultAlgo) {
+        String algo = KeyManagementUtils.getKeyAlgorithm(m,
                                                   props,
                                                   JoseConstants.RSSEC_ENCRYPTION_CONTENT_ALGORITHM,
                                                   defaultAlgo == null ? null : defaultAlgo.getJwaName());