You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2009/07/29 21:49:52 UTC

svn commit: r799037 - /geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java

Author: djencks
Date: Wed Jul 29 19:49:52 2009
New Revision: 799037

URL: http://svn.apache.org/viewvc?rev=799037&view=rev
Log:
GERONIMO-3003 Use idea from Jack Cai to encrypt config.xml attributes that are encryptable but reset to plaintext by users

Modified:
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java?rev=799037&r1=799036&r2=799037&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java Wed Jul 29 19:49:52 2009
@@ -366,6 +366,16 @@
             String valueString = entry.getValue();
             Object value = getValue(attributeInfo, valueString, configName, gbeanName, classLoader);
             data.setAttribute(attributeName, value);
+
+            //encrypt any encryptable attributes set to plaintext by users
+            if (valueString != null) {
+                if (valueString.equals(attributeInfo.getEncryptedSetting().decrypt(valueString))) {
+                    String encrypted = (String) attributeInfo.getEncryptedSetting().encrypt(valueString);
+                    if (!encrypted.equals(valueString)) {
+                        entry.setValue(encrypted);
+                    }
+                }
+            }
         }
 
         //Clear attributes