cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [3/6] cxf git commit: Add an "alias" to the password provider so that we can provide passwords for multiple aliases/certs
Date Mon, 26 Oct 2015 17:09:12 GMT
Add an "alias" to the password provider so that we can provide passwords for multiple aliases/certs


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

Branch: refs/heads/3.0.x-fixes
Commit: 71048a0f77a2b6314857b6d06d8603cf586921d0
Parents: 5f277db
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon Oct 26 15:20:13 2015 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Mon Oct 26 17:08:45 2015 +0000

----------------------------------------------------------------------
 .../apache/cxf/rs/security/jose/common/KeyManagementUtils.java    | 2 +-
 .../cxf/rs/security/jose/common/PrivateKeyPasswordProvider.java   | 2 +-
 .../main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java   | 3 ++-
 .../apache/cxf/systest/jaxrs/security/jwt/JAXRSJweJwsTest.java    | 2 +-
 .../jaxrs/security/jwt/PrivateKeyPasswordProviderImpl.java        | 2 +-
 5 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/71048a0f/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/KeyManagementUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/KeyManagementUtils.java
b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/KeyManagementUtils.java
index 9207e65..57929c2 100644
--- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/KeyManagementUtils.java
+++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/KeyManagementUtils.java
@@ -146,7 +146,7 @@ public final class KeyManagementUtils {
         
         String keyPswd = props.getProperty(JoseConstants.RSSEC_KEY_PSWD);
         String theAlias = alias != null ? alias : getKeyId(m, props, JoseConstants.RSSEC_KEY_STORE_ALIAS,
keyOper);
-        char[] keyPswdChars = provider != null ? provider.getPassword(props) 
+        char[] keyPswdChars = provider != null ? provider.getPassword(theAlias, props) 
             : keyPswd != null ? keyPswd.toCharArray() : null;    
         return CryptoUtils.loadPrivateKey(keyStore, keyPswdChars, theAlias);
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/71048a0f/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/PrivateKeyPasswordProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/PrivateKeyPasswordProvider.java
b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/PrivateKeyPasswordProvider.java
index fc58ee5..86fb0e5 100644
--- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/PrivateKeyPasswordProvider.java
+++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/common/PrivateKeyPasswordProvider.java
@@ -21,5 +21,5 @@ package org.apache.cxf.rs.security.jose.common;
 import java.util.Properties;
 
 public interface PrivateKeyPasswordProvider {
-    char[] getPassword(Properties storeProperties); 
+    char[] getPassword(String alias, Properties storeProperties); 
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/71048a0f/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java
b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java
index 60d3c83..b45b4bc 100644
--- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java
+++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwk/JwkUtils.java
@@ -266,7 +266,8 @@ public final class JwkUtils {
     public static JsonWebKeys loadJwkSet(Properties props, Bus bus, PrivateKeyPasswordProvider
cb, 
                                          JwkReaderWriter reader) {
         JweDecryptionProvider decryption = cb != null
-            ? new AesCbcHmacJweDecryption(new PbesHmacAesWrapKeyDecryptionAlgorithm(cb.getPassword(props)))
: null;
+            ? new AesCbcHmacJweDecryption(new PbesHmacAesWrapKeyDecryptionAlgorithm(
+                cb.getPassword(null, props))) : null;
         return loadJwkSet(props, bus, decryption, reader);
     }
     public static JsonWebKeys loadJwkSet(Properties props, Bus bus, JweDecryptionProvider
jwe, JwkReaderWriter reader) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/71048a0f/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/JAXRSJweJwsTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/JAXRSJweJwsTest.java
b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/JAXRSJweJwsTest.java
index c3e9c7f..629ed0f 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/JAXRSJweJwsTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/JAXRSJweJwsTest.java
@@ -472,7 +472,7 @@ public class JAXRSJweJwsTest extends AbstractBusClientServerTestBase {
             this.password = password;
         }
         @Override
-        public char[] getPassword(Properties storeProperties) {
+        public char[] getPassword(String alias, Properties storeProperties) {
             return password.toCharArray();
         }
         

http://git-wip-us.apache.org/repos/asf/cxf/blob/71048a0f/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/PrivateKeyPasswordProviderImpl.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/PrivateKeyPasswordProviderImpl.java
b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/PrivateKeyPasswordProviderImpl.java
index d9d7153..f01ea93 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/PrivateKeyPasswordProviderImpl.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/jwt/PrivateKeyPasswordProviderImpl.java
@@ -32,7 +32,7 @@ public class PrivateKeyPasswordProviderImpl implements PrivateKeyPasswordProvide
         this.password = password;
     }
     @Override
-    public char[] getPassword(Properties storeProperties) {
+    public char[] getPassword(String alias, Properties storeProperties) {
         return password.toCharArray();
     }
     


Mime
View raw message