You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2016/05/31 15:05:28 UTC

[1/2] cxf git commit: [CXF-6926] - StaticSTSProperties does not allow initialization of crypto from Properties object

Repository: cxf
Updated Branches:
  refs/heads/master e824784db -> 4a0664250


[CXF-6926] - StaticSTSProperties does not allow initialization of crypto from Properties object


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

Branch: refs/heads/master
Commit: 6ee177cc53142ad69589950af1e29077fb034449
Parents: e824784
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Tue May 31 15:57:27 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Tue May 31 15:57:27 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/cxf/rt/security/utils/SecurityUtils.java  | 6 +++++-
 .../src/main/java/org/apache/cxf/sts/StaticSTSProperties.java | 7 ++-----
 2 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/6ee177cc/rt/security/src/main/java/org/apache/cxf/rt/security/utils/SecurityUtils.java
----------------------------------------------------------------------
diff --git a/rt/security/src/main/java/org/apache/cxf/rt/security/utils/SecurityUtils.java b/rt/security/src/main/java/org/apache/cxf/rt/security/utils/SecurityUtils.java
index 046b7c5..b679edb 100644
--- a/rt/security/src/main/java/org/apache/cxf/rt/security/utils/SecurityUtils.java
+++ b/rt/security/src/main/java/org/apache/cxf/rt/security/utils/SecurityUtils.java
@@ -135,13 +135,17 @@ public final class SecurityUtils {
     }
     
     public static Properties loadProperties(Object o) {
+        return loadProperties(null, o);
+    }
+    
+    public static Properties loadProperties(ResourceManager manager, Object o) {
         if (o instanceof Properties) {
             return (Properties)o;
         } 
         
         URL url = null;
         if (o instanceof String) {
-            url = SecurityUtils.loadResource(o);
+            url = SecurityUtils.loadResource(manager, o);
         } else if (o instanceof URL) {
             url = (URL)o;
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/6ee177cc/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java
index c02bf93..0399575 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java
@@ -18,7 +18,6 @@
  */
 package org.apache.cxf.sts;
 
-import java.net.URL;
 import java.util.List;
 import java.util.Properties;
 import java.util.logging.Level;
@@ -73,8 +72,7 @@ public class StaticSTSProperties implements STSPropertiesMBean {
     public void configureProperties() throws STSException {
         if (signatureCrypto == null && signatureCryptoProperties != null) {
             ResourceManager resourceManager = getResourceManager();
-            URL url = SecurityUtils.loadResource(resourceManager, signatureCryptoProperties);
-            Properties sigProperties = SecurityUtils.loadProperties(url);
+            Properties sigProperties = SecurityUtils.loadProperties(resourceManager, signatureCryptoProperties);
             if (sigProperties == null) {
                 LOG.fine("Cannot load signature properties using: " + signatureCryptoProperties);
                 throw new STSException("Configuration error: cannot load signature properties");
@@ -89,8 +87,7 @@ public class StaticSTSProperties implements STSPropertiesMBean {
         
         if (encryptionCrypto == null && encryptionCryptoProperties != null) {
             ResourceManager resourceManager = getResourceManager();
-            URL url = SecurityUtils.loadResource(resourceManager, encryptionCryptoProperties);
-            Properties encrProperties = SecurityUtils.loadProperties(url);
+            Properties encrProperties = SecurityUtils.loadProperties(resourceManager, encryptionCryptoProperties);
             if (encrProperties == null) {
                 LOG.fine("Cannot load encryption properties using: " + encryptionCryptoProperties);
                 throw new STSException("Configuration error: cannot load encryption properties");


[2/2] cxf git commit: CXF-6925 - Make per-realm crypto configuration as flexible as the static one

Posted by co...@apache.org.
CXF-6925 - Make per-realm crypto configuration as flexible as the static one


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

Branch: refs/heads/master
Commit: 4a066425084878cf92e968fde608fc4da1b7343c
Parents: 6ee177c
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Tue May 31 16:02:44 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Tue May 31 16:02:44 2016 +0100

----------------------------------------------------------------------
 .../cxf/sts/token/realm/RealmProperties.java    | 22 ++++++++++++++------
 .../apache/cxf/sts/token/realm/SAMLRealm.java   |  2 +-
 2 files changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/4a066425/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/RealmProperties.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/RealmProperties.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/RealmProperties.java
index 3f5112f..dfe65c6 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/RealmProperties.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/RealmProperties.java
@@ -45,7 +45,7 @@ public class RealmProperties {
     private String signatureAlias;
     private Crypto signatureCrypto;
     private SignatureProperties signatureProperties;
-    private String signaturePropertiesFile;
+    private Object signatureCryptoProperties;
     private String callbackHandlerClass;
     private CallbackHandler callbackHandler;
     
@@ -93,10 +93,20 @@ public class RealmProperties {
      * Set the String corresponding to the signature Properties class
      * @param signaturePropertiesFile the String corresponding to the signature properties file
      */
+    @Deprecated
     public void setSignaturePropertiesFile(String signaturePropertiesFile) {
-        this.signaturePropertiesFile = signaturePropertiesFile;
+        setSignatureCryptoProperties(signaturePropertiesFile);
+    }
+    
+    /**
+     * Set the Object corresponding to the signature Properties class. It can be a String
+     * corresponding to a filename, a Properties object, or a URL.
+     * @param signatureCryptoProperties the object corresponding to the signature properties
+     */
+    public void setSignatureCryptoProperties(Object signatureCryptoProperties) {
+        this.signatureCryptoProperties = signatureCryptoProperties;
         if (LOG.isLoggable(Level.FINE)) {
-            LOG.fine("Setting signature properties: " + signaturePropertiesFile);
+            LOG.fine("Setting signature crypto properties: " + signatureCryptoProperties);
         }
     }
     
@@ -122,10 +132,10 @@ public class RealmProperties {
      * @return the signature Crypto object
      */
     public Crypto getSignatureCrypto() {
-        if (signatureCrypto == null && signaturePropertiesFile != null) {
-            Properties sigProperties = SecurityUtils.loadProperties(signaturePropertiesFile);
+        if (signatureCrypto == null && signatureCryptoProperties != null) {
+            Properties sigProperties = SecurityUtils.loadProperties(signatureCryptoProperties);
             if (sigProperties == null) {
-                LOG.fine("Cannot load signature properties using: " + signaturePropertiesFile);
+                LOG.fine("Cannot load signature properties using: " + signatureCryptoProperties);
                 throw new STSException("Configuration error: cannot load signature properties");
             }
             try {

http://git-wip-us.apache.org/repos/asf/cxf/blob/4a066425/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/SAMLRealm.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/SAMLRealm.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/SAMLRealm.java
index fe2be74..c4a1b40 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/SAMLRealm.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/realm/SAMLRealm.java
@@ -20,7 +20,7 @@
 package org.apache.cxf.sts.token.realm;
 
 /**
- * Use RealmProperties intead
+ * Use RealmProperties instead
  */
 @Deprecated
 public class SAMLRealm extends RealmProperties {