You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2010/09/10 21:44:18 UTC

svn commit: r995953 - in /karaf/trunk: assembly/ assembly/src/main/descriptors/ assembly/src/main/filtered-resources/ assembly/src/main/filtered-resources/etc/ assembly/src/main/filtered-resources/minimal/ features/ features/encryption/ features/encryp...

Author: jbonofre
Date: Fri Sep 10 19:44:18 2010
New Revision: 995953

URL: http://svn.apache.org/viewvc?rev=995953&view=rev
Log:
[KARAF-34] Prepare the encryption feature to provide optionaly encryption.

Added:
    karaf/trunk/features/encryption/
    karaf/trunk/features/encryption/pom.xml   (with props)
    karaf/trunk/features/encryption/src/
    karaf/trunk/features/encryption/src/main/
    karaf/trunk/features/encryption/src/main/resources/
    karaf/trunk/features/encryption/src/main/resources/OSGI-INF/
    karaf/trunk/features/encryption/src/main/resources/OSGI-INF/blueprint/
    karaf/trunk/features/encryption/src/main/resources/OSGI-INF/blueprint/features-encryption.xml   (with props)
Modified:
    karaf/trunk/assembly/pom.xml
    karaf/trunk/assembly/src/main/descriptors/unix-bin.xml
    karaf/trunk/assembly/src/main/descriptors/unix-minimal-bin.xml
    karaf/trunk/assembly/src/main/descriptors/windows-bin.xml
    karaf/trunk/assembly/src/main/descriptors/windows-minimal-bin.xml
    karaf/trunk/assembly/src/main/filtered-resources/etc/startup.properties
    karaf/trunk/assembly/src/main/filtered-resources/features.xml
    karaf/trunk/assembly/src/main/filtered-resources/minimal/startup.properties
    karaf/trunk/features/pom.xml
    karaf/trunk/jaas/modules/pom.xml
    karaf/trunk/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/AbstractKarafLoginModule.java

Modified: karaf/trunk/assembly/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/assembly/pom.xml?rev=995953&r1=995952&r2=995953&view=diff
==============================================================================
--- karaf/trunk/assembly/pom.xml (original)
+++ karaf/trunk/assembly/pom.xml Fri Sep 10 19:44:18 2010
@@ -141,18 +141,6 @@
             <artifactId>org.apache.karaf.shell.dev</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.servicemix.bundles</groupId>
-            <artifactId>org.apache.servicemix.bundles.commons-codec</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.servicemix.bundles</groupId>
-            <artifactId>org.apache.servicemix.bundles.commons-lang</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.servicemix.bundles</groupId>
-            <artifactId>org.apache.servicemix.bundles.jasypt</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.karaf.jaas</groupId>
             <artifactId>org.apache.karaf.jaas.boot</artifactId>
         </dependency>

Modified: karaf/trunk/assembly/src/main/descriptors/unix-bin.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/assembly/src/main/descriptors/unix-bin.xml?rev=995953&r1=995952&r2=995953&view=diff
==============================================================================
--- karaf/trunk/assembly/src/main/descriptors/unix-bin.xml (original)
+++ karaf/trunk/assembly/src/main/descriptors/unix-bin.xml Fri Sep 10 19:44:18 2010
@@ -234,17 +234,6 @@
             <outputDirectory>/system</outputDirectory>
             <unpack>false</unpack>
             <useProjectArtifact>false</useProjectArtifact>
-            <outputFileNameMapping>org/apache/servicemix/bundles/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
-            <includes>
-                <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-codec</include>
-                <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-lang</include>
-                <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.jasypt</include>
-            </includes>
-        </dependencySet>
-        <dependencySet>
-            <outputDirectory>/system</outputDirectory>
-            <unpack>false</unpack>
-            <useProjectArtifact>false</useProjectArtifact>
             <outputFileNameMapping>org/apache/karaf/jaas/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
             <includes>
                 <include>org.apache.karaf.jaas:org.apache.karaf.jaas.config</include>

Modified: karaf/trunk/assembly/src/main/descriptors/unix-minimal-bin.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/assembly/src/main/descriptors/unix-minimal-bin.xml?rev=995953&r1=995952&r2=995953&view=diff
==============================================================================
--- karaf/trunk/assembly/src/main/descriptors/unix-minimal-bin.xml (original)
+++ karaf/trunk/assembly/src/main/descriptors/unix-minimal-bin.xml Fri Sep 10 19:44:18 2010
@@ -215,17 +215,6 @@
                 <include>org.apache.karaf.shell:org.apache.karaf.shell.packages</include>
                 <include>org.apache.karaf.shell:org.apache.karaf.shell.commands</include>
             </includes>
-        </dependencySet>        
-        <dependencySet>
-            <outputDirectory>/system</outputDirectory>
-            <unpack>false</unpack>
-            <useProjectArtifact>false</useProjectArtifact>
-            <outputFileNameMapping>org/apache/servicemix/bundles/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
-            <includes>
-                <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-codec</include>
-                <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-lang</include>
-                <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.jasypt</include>
-            </includes>
         </dependencySet>
         <dependencySet>
             <outputDirectory>/system</outputDirectory>

Modified: karaf/trunk/assembly/src/main/descriptors/windows-bin.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/assembly/src/main/descriptors/windows-bin.xml?rev=995953&r1=995952&r2=995953&view=diff
==============================================================================
--- karaf/trunk/assembly/src/main/descriptors/windows-bin.xml (original)
+++ karaf/trunk/assembly/src/main/descriptors/windows-bin.xml Fri Sep 10 19:44:18 2010
@@ -216,17 +216,6 @@
                 <include>org.apache.karaf.shell:org.apache.karaf.shell.ssh</include>
                 <include>org.apache.karaf.shell:org.apache.karaf.shell.commands</include>
             </includes>
-        </dependencySet>        
-        <dependencySet>
-            <outputDirectory>/system</outputDirectory>
-            <unpack>false</unpack>
-            <useProjectArtifact>false</useProjectArtifact>
-            <outputFileNameMapping>org/apache/servicemix/bundles/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
-            <includes>
-                <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-codec</include>
-                <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-lang</include>
-                <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.jasypt</include>
-            </includes>
         </dependencySet>
         <dependencySet>
             <outputDirectory>/system</outputDirectory>

Modified: karaf/trunk/assembly/src/main/descriptors/windows-minimal-bin.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/assembly/src/main/descriptors/windows-minimal-bin.xml?rev=995953&r1=995952&r2=995953&view=diff
==============================================================================
--- karaf/trunk/assembly/src/main/descriptors/windows-minimal-bin.xml (original)
+++ karaf/trunk/assembly/src/main/descriptors/windows-minimal-bin.xml Fri Sep 10 19:44:18 2010
@@ -209,17 +209,6 @@
             <outputDirectory>/system</outputDirectory>
             <unpack>false</unpack>
             <useProjectArtifact>false</useProjectArtifact>
-            <outputFileNameMapping>org/apache/servicemix/bundles/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
-            <includes>
-                <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-lang</include>
-                <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-codec</include>
-                <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.jasypt</include>
-            </includes>
-        </dependencySet>
-        <dependencySet>
-            <outputDirectory>/system</outputDirectory>
-            <unpack>false</unpack>
-            <useProjectArtifact>false</useProjectArtifact>
             <outputFileNameMapping>org/apache/karaf/jaas/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
             <includes>
                 <include>org.apache.karaf.jaas:org.apache.karaf.jaas.config</include>

Modified: karaf/trunk/assembly/src/main/filtered-resources/etc/startup.properties
URL: http://svn.apache.org/viewvc/karaf/trunk/assembly/src/main/filtered-resources/etc/startup.properties?rev=995953&r1=995952&r2=995953&view=diff
==============================================================================
--- karaf/trunk/assembly/src/main/filtered-resources/etc/startup.properties (original)
+++ karaf/trunk/assembly/src/main/filtered-resources/etc/startup.properties Fri Sep 10 19:44:18 2010
@@ -42,9 +42,6 @@ org/apache/karaf/shell/org.apache.karaf.
 org/apache/karaf/shell/org.apache.karaf.shell.commands/${project.version}/org.apache.karaf.shell.commands-${project.version}.jar=30
 org/apache/karaf/shell/org.apache.karaf.shell.dev/${project.version}/org.apache.karaf.shell.dev-${project.version}.jar=30
 org/apache/karaf/jaas/org.apache.karaf.jaas.config/${project.version}/org.apache.karaf.jaas.config-${project.version}.jar=30
-org/apache/servicemix/bundles/org.apache.servicemix.bundles.commons-codec/${commons-codec.bundle.version}/org.apache.servicemix.bundles.commons-codec-${commons-codec.bundle.version}.jar=30
-org/apache/servicemix/bundles/org.apache.servicemix.bundles.commons-lang/${commons-lang.bundle.version}/org.apache.servicemix.bundles.commons-lang-${commons-lang.bundle.version}.jar=30
-org/apache/servicemix/bundles/org.apache.servicemix.bundles.jasypt/${jasypt.bundle.version}/org.apache.servicemix.bundles.jasypt-${jasypt.bundle.version}.jar=30
 org/apache/karaf/jaas/org.apache.karaf.jaas.modules/${project.version}/org.apache.karaf.jaas.modules-${project.version}.jar=30
 org/apache/karaf/features/org.apache.karaf.features.core/${project.version}/org.apache.karaf.features.core-${project.version}.jar=30
 org/apache/karaf/features/org.apache.karaf.features.command/${project.version}/org.apache.karaf.features.command-${project.version}.jar=30

Modified: karaf/trunk/assembly/src/main/filtered-resources/features.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/assembly/src/main/filtered-resources/features.xml?rev=995953&r1=995952&r2=995953&view=diff
==============================================================================
--- karaf/trunk/assembly/src/main/filtered-resources/features.xml (original)
+++ karaf/trunk/assembly/src/main/filtered-resources/features.xml Fri Sep 10 19:44:18 2010
@@ -94,4 +94,10 @@
         <bundle>mvn:org.apache.aries.jmx/org.apache.aries.jmx/${aries.jmx.version}</bundle>
         <bundle>mvn:org.apache.aries.jmx/org.apache.aries.jmx.blueprint/${aries.jmx.version}</bundle>
     </feature>
+    <feature name="encryption" version="${project.version}">
+        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-codec/${commons-codec.bundle.version}</bundle>
+        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-lang/${commons-lang.bundle.version}</bundle>
+        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jasypt/${jasypt.bundle.version}</bundle>
+        <bundle>mvn:org.apache.karaf.features/org.apache.karaf.features.encryption/${project.version}</bundle>
+    </feature>
 </features>

Modified: karaf/trunk/assembly/src/main/filtered-resources/minimal/startup.properties
URL: http://svn.apache.org/viewvc/karaf/trunk/assembly/src/main/filtered-resources/minimal/startup.properties?rev=995953&r1=995952&r2=995953&view=diff
==============================================================================
--- karaf/trunk/assembly/src/main/filtered-resources/minimal/startup.properties (original)
+++ karaf/trunk/assembly/src/main/filtered-resources/minimal/startup.properties Fri Sep 10 19:44:18 2010
@@ -43,9 +43,6 @@ org/apache/karaf/shell/org.apache.karaf.
 org/apache/karaf/shell/org.apache.karaf.shell.commands/${project.version}/org.apache.karaf.shell.commands-${project.version}.jar=30
 org/apache/karaf/shell/org.apache.karaf.shell.dev/${project.version}/org.apache.karaf.shell.dev-${project.version}.jar=30
 org/apache/karaf/jaas/org.apache.karaf.jaas.config/${project.version}/org.apache.karaf.jaas.config-${project.version}.jar=30
-org/apache/servicemix/bundles/org.apache.servicemix.bundles.commons-codec/${commons-codec.bundle.version}/org.apache.servicemix.bundles.commons-codec-${commons-codec.bundle.version}.jar=30
-org/apache/servicemix/bundles/org.apache.servicemix.bundles.commons-lang/${commons-lang.bundle.version}/org.apache.servicemix.bundles.commons-lang-${commons-lang.bundle.version}.jar=30
-org/apache/servicemix/bundles/org.apache.servicemix.bundles.jasypt/${jasypt.bundle.version}/org.apache.servicemix.bundles.jasypt-${jasypt.bundle.version}.jar=30
 org/apache/karaf/jaas/org.apache.karaf.jaas.modules/${project.version}/org.apache.karaf.jaas.modules-${project.version}.jar=30
 org/apache/karaf/features/org.apache.karaf.features.core/${project.version}/org.apache.karaf.features.core-${project.version}.jar=30
 org/apache/karaf/features/org.apache.karaf.features.command/${project.version}/org.apache.karaf.features.command-${project.version}.jar=30

Added: karaf/trunk/features/encryption/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/features/encryption/pom.xml?rev=995953&view=auto
==============================================================================
--- karaf/trunk/features/encryption/pom.xml (added)
+++ karaf/trunk/features/encryption/pom.xml Fri Sep 10 19:44:18 2010
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements.  See the NOTICE file distributed with
+        this work for additional information regarding copyright ownership.
+        The ASF licenses this file to You 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.
+    -->
+    
+    <modelVersion>4.0.0</modelVersion>
+    
+    <parent>
+        <groupId>org.apache.karaf.features</groupId>
+        <artifactId>features</artifactId>
+        <version>2.0.1-SNAPSHOT</version>
+    </parent>
+    
+    <groupId>org.apache.karaf.features</groupId>
+    <artifactId>org.apache.karaf.features.encryption</artifactId>
+    <packaging>bundle</packaging>
+    <version>2.0.1-SNAPSHOT</version>
+    <name>Apache Karaf :: Features Encryption</name>
+
+</project>
\ No newline at end of file

Propchange: karaf/trunk/features/encryption/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: karaf/trunk/features/encryption/src/main/resources/OSGI-INF/blueprint/features-encryption.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/features/encryption/src/main/resources/OSGI-INF/blueprint/features-encryption.xml?rev=995953&view=auto
==============================================================================
--- karaf/trunk/features/encryption/src/main/resources/OSGI-INF/blueprint/features-encryption.xml (added)
+++ karaf/trunk/features/encryption/src/main/resources/OSGI-INF/blueprint/features-encryption.xml Fri Sep 10 19:44:18 2010
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You 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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <bean id="encryption" class="org.apache.karaf.features.encryption.internal.Encryption" />
+
+    <service ref="encryption" interface="org.apache.karaf.features.Encryption" />
+
+</blueprint>
\ No newline at end of file

Propchange: karaf/trunk/features/encryption/src/main/resources/OSGI-INF/blueprint/features-encryption.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: karaf/trunk/features/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/features/pom.xml?rev=995953&r1=995952&r2=995953&view=diff
==============================================================================
--- karaf/trunk/features/pom.xml (original)
+++ karaf/trunk/features/pom.xml Fri Sep 10 19:44:18 2010
@@ -37,6 +37,7 @@
         <module>command</module>
         <module>management</module>
         <module>obr</module>
+        <module>encryption</module>
     </modules>
 
 </project>

Modified: karaf/trunk/jaas/modules/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/jaas/modules/pom.xml?rev=995953&r1=995952&r2=995953&view=diff
==============================================================================
--- karaf/trunk/jaas/modules/pom.xml (original)
+++ karaf/trunk/jaas/modules/pom.xml Fri Sep 10 19:44:18 2010
@@ -71,12 +71,6 @@
         <dependency>
             <groupId>org.apache.aries.blueprint</groupId>
             <artifactId>org.apache.aries.blueprint</artifactId>
-        </dependency>        
-        
-        <dependency>
-            <groupId>org.apache.servicemix.bundles</groupId>
-            <artifactId>org.apache.servicemix.bundles.jasypt</artifactId>
-            <scope>provided</scope>
         </dependency>
     </dependencies>
 
@@ -93,7 +87,6 @@
                             !${project.artifactId}*,
                             org.apache.karaf.jaas.config,
                             org.apache.aries.blueprint.ext,
-                            org.jasypt*,
                             *
                         </Import-Package>
                         <_versionpolicy>${bnd.version.policy}</_versionpolicy>

Modified: karaf/trunk/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/AbstractKarafLoginModule.java
URL: http://svn.apache.org/viewvc/karaf/trunk/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/AbstractKarafLoginModule.java?rev=995953&r1=995952&r2=995953&view=diff
==============================================================================
--- karaf/trunk/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/AbstractKarafLoginModule.java (original)
+++ karaf/trunk/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/AbstractKarafLoginModule.java Fri Sep 10 19:44:18 2010
@@ -18,13 +18,12 @@ import java.security.Principal;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+
 import javax.security.auth.Subject;
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.login.LoginException;
 import javax.security.auth.spi.LoginModule;
 
-import org.jasypt.util.password.ConfigurablePasswordEncryptor;
-
 
 /**
  * <p>
@@ -45,19 +44,9 @@ public abstract class AbstractKarafLogin
     protected String rolePolicy;
     protected String roleDiscriminator;
     
-    /** 
-     * Algorithm used to encrypt password such as:
-     *  MD2
-     *  MD5
-     *  SHA-1
-     *  SHA-256
-     *  SHA-384
-     *  SHA-512 
-     */
-    protected String encryptionAlgorithm = "MD5";
-    
-    /** Jasypt password encryptor */
-    private ConfigurablePasswordEncryptor passwordEncryptor;
+    // TODO add an encryption attribute types to the Encryption interface
+    // If null, no encryption is used, else the encryption and password
+    // checking is delegated to the encryption service.
 
     public boolean commit() throws LoginException {
         RolePolicy policy = RolePolicy.getPolicy(rolePolicy);
@@ -72,33 +61,6 @@ public abstract class AbstractKarafLogin
     protected void clear() {
         user = null;
     }
-    
-    /**
-     * <p>
-     * Util method to encrypt a password given in plain format.
-     * </p>
-     * 
-     * @param plain the plain password.
-     * @return the encrypted password.
-     */
-    public String encryptPassword(String plain) {
-        ConfigurablePasswordEncryptor encryptor = new ConfigurablePasswordEncryptor();
-        encryptor.setAlgorithm(encryptionAlgorithm);
-        return null;
-    }
-    
-    /**
-     * <p>
-     * Check a password in plain with an encrypted password.
-     * </p>
-     * 
-     * @param plainPassword a plain password in plain.
-     * @param encryptedPassword an encrypted password.
-     * @return true if the plain password match the encrypted one, false else.
-     */
-    public boolean checkPassword(String plainPassword, String encryptedPassword) {
-        return passwordEncryptor.checkPassword(plainPassword, encryptedPassword);
-    }
 
     public void initialize(Subject sub, CallbackHandler handler, Map options) {
         this.subject = sub;
@@ -106,6 +68,5 @@ public abstract class AbstractKarafLogin
         this.rolePolicy = (String) options.get("rolePolicy");
         this.roleDiscriminator = (String) options.get("roleDiscriminator");
         this.debug = Boolean.parseBoolean((String) options.get("debug"));
-        this.encryptionAlgorithm = (String) options.get("encryptionAlgorithm");
     }
 }