You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2005/12/12 23:17:54 UTC
svn commit: r356395 - in /geronimo/branches/1.0: configs/j2ee-system/
modules/system/
modules/system/src/java/org/apache/geronimo/system/configuration/
modules/util/src/java/org/apache/geronimo/util/
Author: ammulder
Date: Mon Dec 12 14:17:43 2005
New Revision: 356395
URL: http://svn.apache.org/viewcvs?rev=356395&view=rev
Log:
Encrypt any GBean attributes in config.xml that have "password" in the name
(GERONIMO-1346)
Add geronimo-util package to the server classpath (it was previously in
lib/ but not on the manifest)
Added:
geronimo/branches/1.0/modules/util/src/java/org/apache/geronimo/util/EncryptionManager.java (with props)
Modified:
geronimo/branches/1.0/configs/j2ee-system/project.properties
geronimo/branches/1.0/modules/system/project.xml
geronimo/branches/1.0/modules/system/src/java/org/apache/geronimo/system/configuration/GBeanOverride.java
Modified: geronimo/branches/1.0/configs/j2ee-system/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/configs/j2ee-system/project.properties?rev=356395&r1=356394&r2=356395&view=diff
==============================================================================
--- geronimo/branches/1.0/configs/j2ee-system/project.properties (original)
+++ geronimo/branches/1.0/configs/j2ee-system/project.properties Mon Dec 12 14:17:43 2005
@@ -29,6 +29,7 @@
../lib/geronimo-common-${geronimo_version}.jar \
../lib/geronimo-kernel-${geronimo_version}.jar \
../lib/geronimo-system-${geronimo_version}.jar \
+ ../lib/geronimo-util-${geronimo_version}.jar \
../lib/cglib-nodep-${cglib_version}.jar \
../lib/commons-cli-${commons_cli_version}.jar \
../lib/commons-logging-${commons_logging_version}.jar \
Modified: geronimo/branches/1.0/modules/system/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/system/project.xml?rev=356395&r1=356394&r2=356395&view=diff
==============================================================================
--- geronimo/branches/1.0/modules/system/project.xml (original)
+++ geronimo/branches/1.0/modules/system/project.xml Mon Dec 12 14:17:43 2005
@@ -49,6 +49,12 @@
<dependency>
<groupId>geronimo</groupId>
+ <artifactId>geronimo-util</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>geronimo</groupId>
<artifactId>geronimo-kernel</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
Modified: geronimo/branches/1.0/modules/system/src/java/org/apache/geronimo/system/configuration/GBeanOverride.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/system/src/java/org/apache/geronimo/system/configuration/GBeanOverride.java?rev=356395&r1=356394&r2=356395&view=diff
==============================================================================
--- geronimo/branches/1.0/modules/system/src/java/org/apache/geronimo/system/configuration/GBeanOverride.java (original)
+++ geronimo/branches/1.0/modules/system/src/java/org/apache/geronimo/system/configuration/GBeanOverride.java Mon Dec 12 14:17:43 2005
@@ -20,6 +20,7 @@
import org.apache.geronimo.gbean.GAttributeInfo;
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.util.EncryptionManager;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -109,7 +110,7 @@
Element attribute = (Element) attributes.item(a);
String attributeName = attribute.getAttribute("name");
- String attributeValue = getContentsAsText(attribute);
+ String attributeValue = (String)EncryptionManager.decrypt(getContentsAsText(attribute));
setAttribute(attributeName, attributeValue);
}
@@ -222,6 +223,9 @@
Map.Entry entry = (Map.Entry) iterator.next();
String name = (String) entry.getKey();
String value = (String) entry.getValue();
+ if(name.toLowerCase().indexOf("password") > -1) {
+ value = EncryptionManager.encrypt(value);
+ }
out.println(" <attribute name=\"" + name + "\">" + value + "</attribute>");
}
Added: geronimo/branches/1.0/modules/util/src/java/org/apache/geronimo/util/EncryptionManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/util/src/java/org/apache/geronimo/util/EncryptionManager.java?rev=356395&view=auto
==============================================================================
--- geronimo/branches/1.0/modules/util/src/java/org/apache/geronimo/util/EncryptionManager.java (added)
+++ geronimo/branches/1.0/modules/util/src/java/org/apache/geronimo/util/EncryptionManager.java Mon Dec 12 14:17:43 2005
@@ -0,0 +1,49 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.util;
+
+import java.io.Serializable;
+
+/**
+ * A static class that handles storing and reading values, potentially using
+ * encryption. This can be used as the interface to any back-end encryption
+ * services.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class EncryptionManager {
+ private final static String SIMPLE_ENCRYPTION_PREFIX = "{Simple}";
+
+ /**
+ * Gets a String which contains the Base64-encoded form of the
+ * encrypted form of the source.
+ */
+ public static String encrypt(Serializable source) {
+ return SIMPLE_ENCRYPTION_PREFIX +SimpleEncryption.encrypt(source);
+ }
+
+ /**
+ * Given a String which is the Base64-encoded encrypted data, retrieve
+ * the original Object.
+ */
+ public static Object decrypt(String source) {
+ if(source.startsWith(SIMPLE_ENCRYPTION_PREFIX)) {
+ return SimpleEncryption.decrypt(source.substring(SIMPLE_ENCRYPTION_PREFIX.length()));
+ }
+ return source;
+ }
+}
Propchange: geronimo/branches/1.0/modules/util/src/java/org/apache/geronimo/util/EncryptionManager.java
------------------------------------------------------------------------------
svn:eol-style = native