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 2012/12/17 12:00:45 UTC

svn commit: r1422848 - /cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java

Author: coheigea
Date: Mon Dec 17 11:00:44 2012
New Revision: 1422848

URL: http://svn.apache.org/viewvc?rev=1422848&view=rev
Log:
[CXF-4705] - Allow STS to configure signature + encryption crypto objects via URL + Properties object

Modified:
    cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java

Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java?rev=1422848&r1=1422847&r2=1422848&view=diff
==============================================================================
--- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java (original)
+++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java Mon Dec 17 11:00:44 2012
@@ -51,10 +51,10 @@ public class StaticSTSProperties impleme
     private CallbackHandler callbackHandler;
     private String callbackHandlerClass;
     private Crypto signatureCrypto;
-    private String signaturePropertiesFile;
+    private Object signatureCryptoProperties;
     private String signatureUsername;
     private Crypto encryptionCrypto;
-    private String encryptionPropertiesFile;
+    private Object encryptionCryptoProperties;
     private String encryptionUsername;
     private String issuer;
     private SignatureProperties signatureProperties = new SignatureProperties();
@@ -68,10 +68,10 @@ public class StaticSTSProperties impleme
      * Load the CallbackHandler, Crypto objects, if necessary.
      */
     public void configureProperties() throws STSException {
-        if (signatureCrypto == null && signaturePropertiesFile != null) {
-            Properties sigProperties = getProps(signaturePropertiesFile);
+        if (signatureCrypto == null && signatureCryptoProperties != null) {
+            Properties sigProperties = getProps(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 {
@@ -82,10 +82,10 @@ public class StaticSTSProperties impleme
             }
         }
         
-        if (encryptionCrypto == null && encryptionPropertiesFile != null) {
-            Properties encrProperties = getProps(encryptionPropertiesFile);
+        if (encryptionCrypto == null && encryptionCryptoProperties != null) {
+            Properties encrProperties = getProps(encryptionCryptoProperties);
             if (encrProperties == null) {
-                LOG.fine("Cannot load encryption properties using: " + encryptionPropertiesFile);
+                LOG.fine("Cannot load encryption properties using: " + encryptionCryptoProperties);
                 throw new STSException("Configuration error: cannot load encryption properties");
             }
             try {
@@ -144,9 +144,19 @@ public class StaticSTSProperties impleme
      * 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;
-        LOG.fine("Setting signature properties: " + 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;
+        LOG.fine("Setting signature crypto properties: " + signatureCryptoProperties);
     }
     
     /**
@@ -186,9 +196,19 @@ public class StaticSTSProperties impleme
      * Set the String corresponding to the encryption Properties class
      * @param signaturePropertiesFile the String corresponding to the encryption properties file
      */
+    @Deprecated
     public void setEncryptionPropertiesFile(String encryptionPropertiesFile) {
-        this.encryptionPropertiesFile = encryptionPropertiesFile;
-        LOG.fine("Setting encryptionProperties: " + encryptionPropertiesFile);
+        setEncryptionCryptoProperties(encryptionPropertiesFile);
+    }
+    
+    /**
+     * Set the Object corresponding to the encryption Properties class. It can be a String
+     * corresponding to a filename, a Properties object, or a URL.
+     * @param encryptionCryptoProperties the object corresponding to the encryption properties
+     */
+    public void setEncryptionCryptoProperties(Object encryptionCryptoProperties) {
+        this.encryptionCryptoProperties = encryptionCryptoProperties;
+        LOG.fine("Setting encryptionProperties: " + encryptionCryptoProperties);
     }
     
     /**