geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r799037 - /geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/GBeanOverride.java
Date Wed, 29 Jul 2009 19:49:52 GMT
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



Mime
View raw message