You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2008/05/20 18:10:40 UTC

svn commit: r658306 - in /servicemix/smx4/kernel/trunk: ./ assembly/ assembly/src/main/descriptors/ assembly/src/main/distribution/text/etc/ assembly/src/main/distribution/unix-shell/bin/ assembly/src/main/distribution/windows-text/bin/ assembly/src/ma...

Author: gnodet
Date: Tue May 20 09:10:38 2008
New Revision: 658306

URL: http://svn.apache.org/viewvc?rev=658306&view=rev
Log:
SMX4KNL-37: JAAS support

Added:
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/SpringLoginHandler.java
    servicemix/smx4/kernel/trunk/jaas/   (with props)
    servicemix/smx4/kernel/trunk/jaas/jaas-boot/   (with props)
    servicemix/smx4/kernel/trunk/jaas/jaas-boot/pom.xml
    servicemix/smx4/kernel/trunk/jaas/jaas-boot/src/
    servicemix/smx4/kernel/trunk/jaas/jaas-boot/src/main/
    servicemix/smx4/kernel/trunk/jaas/jaas-boot/src/main/java/
    servicemix/smx4/kernel/trunk/jaas/jaas-boot/src/main/java/org/
    servicemix/smx4/kernel/trunk/jaas/jaas-boot/src/main/java/org/apache/
    servicemix/smx4/kernel/trunk/jaas/jaas-boot/src/main/java/org/apache/servicemix/
    servicemix/smx4/kernel/trunk/jaas/jaas-boot/src/main/java/org/apache/servicemix/kernel/
    servicemix/smx4/kernel/trunk/jaas/jaas-boot/src/main/java/org/apache/servicemix/kernel/jaas/
    servicemix/smx4/kernel/trunk/jaas/jaas-boot/src/main/java/org/apache/servicemix/kernel/jaas/boot/
    servicemix/smx4/kernel/trunk/jaas/jaas-boot/src/main/java/org/apache/servicemix/kernel/jaas/boot/ProxyLoginModule.java
    servicemix/smx4/kernel/trunk/jaas/jaas-config/   (with props)
    servicemix/smx4/kernel/trunk/jaas/jaas-config/pom.xml
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/Config.java
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/JaasRealm.java
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/Module.java
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/NamespaceHandler.java
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/OsgiConfiguration.java
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/ProxyLoginModuleInitializer.java
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring.handlers
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring.schemas
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring/servicemix-jaas.xml
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/org/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/org/apache/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/org/apache/servicemix/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/org/apache/servicemix/kernel/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/org/apache/servicemix/kernel/jaas/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/org/apache/servicemix/kernel/jaas/config/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/org/apache/servicemix/kernel/jaas/config/servicemix-jaas.xsd
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/java/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/java/org/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/java/org/apache/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/java/org/apache/servicemix/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/java/org/apache/servicemix/kernel/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/java/org/apache/servicemix/kernel/jaas/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/java/org/apache/servicemix/kernel/jaas/config/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/java/org/apache/servicemix/kernel/jaas/config/NamespaceHandlerTest.java
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/resources/
    servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/resources/config.xml
    servicemix/smx4/kernel/trunk/jaas/pom.xml
Removed:
    servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/login.conf
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/geronimo/gshell/spring/etc/login.conf
Modified:
    servicemix/smx4/kernel/trunk/assembly/pom.xml
    servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml
    servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml
    servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/config.properties
    servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/system.properties
    servicemix/smx4/kernel/trunk/assembly/src/main/distribution/unix-shell/bin/servicemix
    servicemix/smx4/kernel/trunk/assembly/src/main/distribution/windows-text/bin/servicemix.bat
    servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties
    servicemix/smx4/kernel/trunk/gshell/gshell-core/pom.xml
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/filtered-resources/org/apache/geronimo/gshell/spring/etc/startup.properties
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/CreateCommand.java
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-remote.xml
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/geronimo/gshell/spring/etc/config.properties
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/geronimo/gshell/spring/etc/system.properties
    servicemix/smx4/kernel/trunk/pom.xml
    servicemix/smx4/kernel/trunk/spring/pom.xml

Modified: servicemix/smx4/kernel/trunk/assembly/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/pom.xml?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/assembly/pom.xml Tue May 20 09:10:38 2008
@@ -174,6 +174,16 @@
           <artifactId>geronimo-servlet_2.5_spec</artifactId>
           <version>${geronimo.servlet.version}</version>
       </dependency>
+      <dependency>
+          <groupId>org.apache.servicemix.kernel.jaas</groupId>
+          <artifactId>org.apache.servicemix.kernel.jaas.boot</artifactId>
+          <version>${pom.version}</version>
+      </dependency>
+      <dependency>
+          <groupId>org.apache.servicemix.kernel.jaas</groupId>
+          <artifactId>org.apache.servicemix.kernel.jaas.config</artifactId>
+          <version>${pom.version}</version>
+        </dependency>
     </dependencies>
     <build>
         <resources>
@@ -218,6 +228,13 @@
                                     <outputDirectory>target/dependencies</outputDirectory>
                                     <destFileName>servicemix.jar</destFileName>
                                 </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.apache.servicemix.kernel.jaas</groupId>
+                                    <artifactId>org.apache.servicemix.kernel.jaas.boot</artifactId>
+                                    <version>${pom.version}</version>
+                                    <outputDirectory>target/dependencies</outputDirectory>
+                                    <destFileName>servicemix-jaas-boot.jar</destFileName>
+                                </artifactItem>
                             </artifactItems>
                         </configuration>
                     </execution>

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml Tue May 20 09:10:38 2008
@@ -129,7 +129,10 @@
                 <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.cglib-${cglib.version}</include>
                 <include>org.apache.servicemix.kernel:org.apache.servicemix.kernel.spring</include>
 
-		        <!-- GShell -->
+                <!-- JAAS -->
+                <include>org.apache.servicemix.kernel.jaas:org.apache.servicemix.kernel.jaas.config</include>
+
+                <!-- GShell -->
                 <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.mina-${mina.version}</include>
                 <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.core</include>
                 <include>org.apache.servicemix.kernel.gshell:org.apache.servicemix.kernel.gshell.osgi</include>

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml Tue May 20 09:10:38 2008
@@ -121,6 +121,9 @@
                 <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.cglib-${cglib.version}</include>
                 <include>org.apache.servicemix.kernel:org.apache.servicemix.kernel.spring</include>
 
+                <!-- JAAS -->
+                <include>org.apache.servicemix.kernel.jaas:org.apache.servicemix.kernel.jaas.config</include>
+
 		        <!-- GShell -->
                 <include>org.apache.geronimo.specs:geronimo-stax-api_1.0_spec</include>
                 <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.mina-${mina.version}</include>

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/config.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/config.properties?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/config.properties (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/config.properties Tue May 20 09:10:38 2008
@@ -25,6 +25,7 @@
  org.osgi.service.startlevel; version=1.0.0, \
  org.osgi.service.url; version=1.0.0, \
  org.apache.servicemix.kernel.main.spi, \
+ org.apache.servicemix.kernel.jaas.boot, \
  com.sun.management, \
  com.sun.org.apache.xalan.internal.xsltc.trax, \
  com.sun.org.apache.xerces.internal.dom, \

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/system.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/system.properties?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/system.properties (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/system.properties Tue May 20 09:10:38 2008
@@ -17,5 +17,4 @@
 #
 ################################################################################
 
-java.security.auth.login.config=${servicemix.base}/etc/login.conf
 org.ops4j.pax.logging.DefaultServiceLog.level=ERROR

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/distribution/unix-shell/bin/servicemix
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/distribution/unix-shell/bin/servicemix?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/distribution/unix-shell/bin/servicemix (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/distribution/unix-shell/bin/servicemix Tue May 20 09:10:38 2008
@@ -212,7 +212,11 @@
     fi
 
     # Add the conf directory so it picks up the Log4J config
-    CLASSPATH="$CLASSPATH:$SERVICEMIX_BASE/conf"
+    if [ "x$CLASSPATH" = "x" ]; then
+        CLASSPATH="$SERVICEMIX_HOME/lib/servicemix.jar:$SERVICEMIX_HOME/lib/servicemix-jaas-boot.jar"
+    else
+        CLASSPATH="$CLASSPATH:$SERVICEMIX_HOME/lib/servicemix.jar:$SERVICEMIX_HOME/lib/servicemix-jaas-boot.jar"
+    fi
     DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
 
     ##
@@ -268,12 +272,11 @@
             ;;
     esac
 
-    JAR=$SERVICEMIX_HOME/lib/servicemix.jar
     if $cygwin; then
         SERVICEMIX_HOME=`cygpath --path --windows "$SERVICEMIX_HOME"`
         SERVICEMIX_BASE=`cygpath --path --windows "$SERVICEMIX_BASE"`
     fi
-    exec $JAVA $JAVA_OPTS -Dservicemix.home="$SERVICEMIX_HOME" -Dservicemix.base="$SERVICEMIX_BASE" $OPTS -jar "$JAR" $*
+    exec $JAVA $JAVA_OPTS -Dservicemix.home="$SERVICEMIX_HOME" -Dservicemix.base="$SERVICEMIX_BASE" $OPTS -classpath "$CLASSPATH" org.apache.servicemix.kernel.main.Main $*
 }
 
 main() {

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/distribution/windows-text/bin/servicemix.bat
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/distribution/windows-text/bin/servicemix.bat?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/distribution/windows-text/bin/servicemix.bat (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/distribution/windows-text/bin/servicemix.bat Tue May 20 09:10:38 2008
@@ -107,7 +107,7 @@
 :SERVICEMIX_PROFILER_END
 
 rem Setup the classpath
-set CLASSPATH=%CLASSPATH%;%SERVICEMIX_HOME%\lib\classworlds-1.0.1.jar
+set CLASSPATH=%CLASSPATH%;%SERVICEMIX_BASE%\conf;$SERVICEMIX_HOME\lib\servicemix-jaas-boot.jar
 
 rem Execute the JVM or the load the profiler
 if "%SERVICEMIX_PROFILER%" == "" goto :EXECUTE
@@ -118,7 +118,7 @@
 :EXECUTE
     SET OPTS=-Dservicemix.startLocalConsole=true -Dservicemix.startRemoteShell=true    
     rem Execute the Java Virtual Machine
-    "%JAVA%" %JAVA_OPTS% %OPTS% -Dservicemix.home="%SERVICEMIX_HOME%" -Dservicemix.base="%SERVICEMIX_BASE%" -jar "%SERVICEMIX_HOME%\lib\servicemix.jar" %*
+    "%JAVA%" %JAVA_OPTS% %OPTS% -classpath %CLASSPATH% -Dservicemix.home="%SERVICEMIX_HOME%" -Dservicemix.base="%SERVICEMIX_BASE%" org.apache.servicemix.kernel.main.Main %*
 
 rem # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties Tue May 20 09:10:38 2008
@@ -52,6 +52,7 @@
 org.apache.servicemix.kernel.gshell.osgi-${pom.version}.jar=50
 org.apache.servicemix.kernel.gshell.features-${pom.version}.jar=50
 org.apache.servicemix.kernel.gshell.log-${pom.version}.jar=50
+org.apache.servicemix.kernel.jaas.config-${pom.version}.jar=50
 
 #
 # Start console last

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/pom.xml?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/pom.xml Tue May 20 09:10:38 2008
@@ -39,6 +39,7 @@
 
     <properties>
         <gshell.osgi.import>
+            org.apache.servicemix.kernel.jaas.config;resolution:=optional,
             org.apache.servicemix.kernel.main.spi.*;resolution:=optional,
             com.thoughtworks.xstream*;resolution:=optional,
             junit.framework*;resolution:=optional,

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/filtered-resources/org/apache/geronimo/gshell/spring/etc/startup.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/filtered-resources/org/apache/geronimo/gshell/spring/etc/startup.properties?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/filtered-resources/org/apache/geronimo/gshell/spring/etc/startup.properties (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/filtered-resources/org/apache/geronimo/gshell/spring/etc/startup.properties Tue May 20 09:10:38 2008
@@ -52,6 +52,7 @@
 org.apache.servicemix.kernel.gshell.osgi-${pom.version}.jar=50
 org.apache.servicemix.kernel.gshell.features-${pom.version}.jar=50
 org.apache.servicemix.kernel.gshell.log-${pom.version}.jar=50
+org.apache.servicemix.kernel.jaas.config-${pom.version}.jar=50
 
 #
 # Start console last

Added: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/SpringLoginHandler.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/SpringLoginHandler.java?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/SpringLoginHandler.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/SpringLoginHandler.java Tue May 20 09:10:38 2008
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+package org.apache.geronimo.gshell.remote.server.handler;
+
+import org.apache.geronimo.gshell.common.Notification;
+import org.apache.geronimo.gshell.remote.message.LoginMessage;
+import org.apache.geronimo.gshell.whisper.transport.Session;
+import org.apache.geronimo.gshell.remote.server.timeout.TimeoutManager;
+
+public class SpringLoginHandler extends LoginHandler {
+
+    private String defaultRealm;
+
+    public SpringLoginHandler(final TimeoutManager timeoutManager, String defaultRealm) {
+        super(timeoutManager);
+        this.defaultRealm = defaultRealm;
+    }
+
+    public void handle(Session session, ServerSessionContext context, LoginMessage message) throws Exception {
+        if (message.getRealm() == null) {
+            message = new LoginMessage(message.getUsername(), message.getPassword(), defaultRealm);
+        }
+        super.handle(session, context, message);
+    }
+
+}

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/CreateCommand.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/CreateCommand.java?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/CreateCommand.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/CreateCommand.java Tue May 20 09:10:38 2008
@@ -47,7 +47,7 @@
     	
     	try {
 			File serviceMixBase = new File(instance).getCanonicalFile();
-			io.out.println("Creating new instance at:@|bold "+serviceMixBase+"|");
+			io.out.println("Creating new instance at: @|bold " + serviceMixBase + "|");
 			
 			mkdir(serviceMixBase, "bin");
 			mkdir(serviceMixBase, "etc");
@@ -56,7 +56,6 @@
 			mkdir(serviceMixBase, "data");
 			
 			copyResourceToDir(serviceMixBase, "etc/config.properties", true);
-			copyResourceToDir(serviceMixBase, "etc/login.conf", true);
 			copyResourceToDir(serviceMixBase, "etc/org.apache.servicemix.features.cfg", true);
 			copyResourceToDir(serviceMixBase, "etc/org.apache.servicemix.shell.cfg", true);
 			copyResourceToDir(serviceMixBase, "etc/org.ops4j.pax.logging.cfg", true);
@@ -83,7 +82,7 @@
 	private void copyResourceToDir(File target, String resource, boolean text) throws Exception {
 		File outFile = new File(target, resource);
 		if( !outFile.exists() ) {
-	        io.out.println("Creating file:@|bold "+outFile.getPath()+"|");
+	        io.out.println("Creating file: @|bold " + outFile.getPath() + "|");
 			InputStream is = CreateCommand.class.getResourceAsStream(resource);
 			try {
 				if( text ) {

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-remote.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-remote.xml?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-remote.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-remote.xml Tue May 20 09:10:38 2008
@@ -20,11 +20,14 @@
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:util="http://www.springframework.org/schema/util"
+       xmlns:jaas="http://servicemix.apache.org/jaas"
        xsi:schemaLocation="
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd
   http://www.springframework.org/schema/util
-  http://www.springframework.org/schema/util/spring-util.xsd">
+  http://www.springframework.org/schema/util/spring-util.xsd
+  http://servicemix.apache.org/jaas
+  http://servicemix.apache.org/schema/servicemix-jaas.xsd">
 
     <bean id="rshServer" class="org.apache.geronimo.gshell.remote.server.RshServer">
         <constructor-arg ref="timeoutManager" />
@@ -38,8 +41,9 @@
                 </bean>
                 <bean class="org.apache.geronimo.gshell.remote.server.handler.EchoHandler" />
                 <bean class="org.apache.geronimo.gshell.remote.server.handler.SpringExecuteHandler" />
-                <bean class="org.apache.geronimo.gshell.remote.server.handler.LoginHandler" init-method="initialize">
+                <bean class="org.apache.geronimo.gshell.remote.server.handler.SpringLoginHandler" init-method="initialize">
                     <constructor-arg ref="timeoutManager" />
+                    <constructor-arg value="RshServer" />
                 </bean>
                 <bean class="org.apache.geronimo.gshell.remote.server.handler.SpringOpenShellHandler">
                     <constructor-arg ref="shellInfo" />
@@ -93,4 +97,12 @@
         </constructor-arg>
     </bean>
 
+    <jaas:config id="RshClient">
+        <jaas:module className="org.apache.geronimo.gshell.remote.client.auth.RemoteLoginModule" flags="required" />
+    </jaas:config>
+
+    <jaas:config id="RshServer">
+        <jaas:module className="org.apache.geronimo.gshell.remote.server.auth.BogusLoginModule" flags="required" />
+    </jaas:config>
+
 </beans>
\ No newline at end of file

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/geronimo/gshell/spring/etc/config.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/geronimo/gshell/spring/etc/config.properties?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/geronimo/gshell/spring/etc/config.properties (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/geronimo/gshell/spring/etc/config.properties Tue May 20 09:10:38 2008
@@ -25,7 +25,12 @@
  org.osgi.service.startlevel; version=1.0.0, \
  org.osgi.service.url; version=1.0.0, \
  org.apache.servicemix.kernel.main.spi, \
+ org.apache.servicemix.kernel.jaas.boot, \
  com.sun.management, \
+ com.sun.org.apache.xalan.internal.xsltc.trax, \
+ com.sun.org.apache.xerces.internal.dom, \
+ com.sun.org.apache.xerces.internal.jaxp, \
+ com.sun.org.apache.xerces.internal.xni, \
  ${jre-${java.specification.version}}
 #org.osgi.framework.bootdelegation=sun.*,com.sun.*
 

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/geronimo/gshell/spring/etc/system.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/geronimo/gshell/spring/etc/system.properties?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/geronimo/gshell/spring/etc/system.properties (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/geronimo/gshell/spring/etc/system.properties Tue May 20 09:10:38 2008
@@ -17,5 +17,4 @@
 #
 ################################################################################
 
-java.security.auth.login.config=${servicemix.base}/etc/login.conf
 org.ops4j.pax.logging.DefaultServiceLog.level=ERROR
\ No newline at end of file

Propchange: servicemix/smx4/kernel/trunk/jaas/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 20 09:10:38 2008
@@ -0,0 +1,9 @@
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
+
+

Propchange: servicemix/smx4/kernel/trunk/jaas/jaas-boot/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 20 09:10:38 2008
@@ -0,0 +1,9 @@
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
+
+

Added: servicemix/smx4/kernel/trunk/jaas/jaas-boot/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/jaas-boot/pom.xml?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/jaas-boot/pom.xml (added)
+++ servicemix/smx4/kernel/trunk/jaas/jaas-boot/pom.xml Tue May 20 09:10:38 2008
@@ -0,0 +1,65 @@
+<?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/maven-v4_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.servicemix.kernel.jaas</groupId>
+        <artifactId>jaas</artifactId>
+        <version>1.0-m4-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.kernel.jaas</groupId>
+    <artifactId>org.apache.servicemix.kernel.jaas.boot</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.0-m4-SNAPSHOT</version>
+    <name>Apache ServiceMix Kernel :: JAAS Boot</name>
+
+    <description>
+        Provides the JAAS Boot classes
+    </description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>${felix.osgi.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
+                        <Export-Package>org.apache.servicemix*;version=${project.version};-split-package:=merge-first</Export-Package>
+                        <Import-Package>*</Import-Package>
+                        <Private-Package>!*</Private-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Added: servicemix/smx4/kernel/trunk/jaas/jaas-boot/src/main/java/org/apache/servicemix/kernel/jaas/boot/ProxyLoginModule.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/jaas-boot/src/main/java/org/apache/servicemix/kernel/jaas/boot/ProxyLoginModule.java?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/jaas-boot/src/main/java/org/apache/servicemix/kernel/jaas/boot/ProxyLoginModule.java (added)
+++ servicemix/smx4/kernel/trunk/jaas/jaas-boot/src/main/java/org/apache/servicemix/kernel/jaas/boot/ProxyLoginModule.java Tue May 20 09:10:38 2008
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ */
+package org.apache.servicemix.kernel.jaas.boot;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import javax.security.auth.spi.LoginModule;
+import javax.security.auth.Subject;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.callback.CallbackHandler;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Bundle;
+
+/**
+ * An OSGi proxy login module that should be used instead of a plain reference to
+ * a given login module.  Two properties must be set, the name of the login module
+ * class and the bundle to be used to load it.
+ * This class must be available from all modules, so it has to be either in a fragment
+ * bundle attached to the system bundle or be made available through the boot delegation
+ * class path.
+ */
+public class ProxyLoginModule implements LoginModule {
+
+    public static final String PROPERTY_MODULE = "org.apache.servicemix.kernel.jaas.module";
+    public static final String PROPERTY_BUNDLE = "org.apache.servicemix.kernel.jaas.bundle";
+
+    private static BundleContext bundleContext = null;
+    
+    private LoginModule target = null;
+
+    public static void init(BundleContext context) {
+        bundleContext = context;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.security.auth.spi.LoginModule#initialize(javax.security.auth.Subject, javax.security.auth.callback.CallbackHandler, java.util.Map, java.util.Map)
+     */
+    public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
+        if (bundleContext == null) {
+            throw new IllegalStateException("ProxyLoginModule not initialized. Init must be called prior any invocation.");
+        }
+        Map<String,?> newOptions = new HashMap<String,Object>(options);
+        String module = (String) newOptions.remove(PROPERTY_MODULE);
+        if (module == null) {
+            throw new IllegalStateException("Option " + PROPERTY_MODULE + " must be set to the name of the factory service");
+        }
+        String bundleId = (String) newOptions.remove(PROPERTY_BUNDLE);
+        if (bundleId == null) {
+            throw new IllegalStateException("Option " + PROPERTY_BUNDLE + " must be set to the name of the factory service");
+        }
+        Bundle bundle = bundleContext.getBundle(Long.parseLong(bundleId));
+        if (bundle == null) {
+            throw new IllegalStateException("No bundle found for id " + bundleId);
+        }
+        try {
+            target = (LoginModule) bundle.loadClass(module).newInstance();
+        } catch (Exception e) {
+            throw new IllegalStateException("Can not load or create login module " + module + " for bundle " + bundleId, e);
+        }
+        target.initialize(subject, callbackHandler, sharedState, options);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.security.auth.spi.LoginModule#login()
+     */
+    public boolean login() throws LoginException {
+        return target.login();
+    }
+
+    /* (non-Javadoc)
+     * @see javax.security.auth.spi.LoginModule#commit()
+     */
+    public boolean commit() throws LoginException {
+        return target.commit();
+    }
+
+    /* (non-Javadoc)
+     * @see javax.security.auth.spi.LoginModule#abort()
+     */
+    public boolean abort() throws LoginException {
+        return target.abort();
+    }
+
+    /* (non-Javadoc)
+     * @see javax.security.auth.spi.LoginModule#logout()
+     */
+    public boolean logout() throws LoginException {
+        return target.logout();
+    }
+
+}

Propchange: servicemix/smx4/kernel/trunk/jaas/jaas-config/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 20 09:10:38 2008
@@ -0,0 +1,9 @@
+target
+*.iml
+*.ipr
+*.iws
+.classpath
+.project
+.settings
+
+

Added: servicemix/smx4/kernel/trunk/jaas/jaas-config/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/jaas-config/pom.xml?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/jaas-config/pom.xml (added)
+++ servicemix/smx4/kernel/trunk/jaas/jaas-config/pom.xml Tue May 20 09:10:38 2008
@@ -0,0 +1,103 @@
+<?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/maven-v4_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.servicemix.kernel.jaas</groupId>
+        <artifactId>jaas</artifactId>
+        <version>1.0-m4-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.kernel.jaas</groupId>
+    <artifactId>org.apache.servicemix.kernel.jaas.config</artifactId>
+    <packaging>bundle</packaging>
+    <version>1.0-m4-SNAPSHOT</version>
+    <name>Apache ServiceMix Kernel :: JAAS Config</name>
+
+    <description>
+        Provides the JAAS Config
+    </description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.servicemix.kernel.jaas</groupId>
+            <artifactId>org.apache.servicemix.kernel.jaas.boot</artifactId>
+            <version>${pom.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>${felix.osgi.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.osgi</groupId>
+            <artifactId>spring-osgi-core</artifactId>
+            <version>${spring.osgi.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>${commons.logging.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>${junit.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>aopalliance</groupId>
+            <artifactId>aopalliance</artifactId>
+            <version>${aopalliance.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jmock</groupId>
+            <artifactId>jmock</artifactId>
+            <version>2.4.0</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
+                        <Export-Package>
+                            org.apache.servicemix.kernel.jaas.config*;version=${project.version};-split-package:=merge-first
+                        </Export-Package>
+                        <Import-Package>*</Import-Package>
+                        <Private-Package>!*</Private-Package>
+                        <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Added: servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/Config.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/Config.java?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/Config.java (added)
+++ servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/Config.java Tue May 20 09:10:38 2008
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+package org.apache.servicemix.kernel.jaas.config;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import javax.security.auth.login.AppConfigurationEntry;
+
+import org.apache.servicemix.kernel.jaas.boot.ProxyLoginModule;
+import org.springframework.osgi.context.BundleContextAware;
+import org.osgi.framework.BundleContext;
+
+/**
+ * An implementation of JaasRealm which is created
+ * by the spring namespace handler.
+ */
+public class Config implements JaasRealm, BundleContextAware {
+
+    private String name;
+    private int rank;
+    private Module[] modules;
+    private BundleContext bundleContext;
+    private transient AppConfigurationEntry[] entries;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getRank() {
+        return rank;
+    }
+
+    public void setRank(int rank) {
+        this.rank = rank;
+    }
+
+    public Module[] getModules() {
+        return modules;
+    }
+
+    public void setModules(Module[] modules) {
+        this.modules = modules;
+        this.entries = null;
+    }
+
+    public BundleContext getBundleContext() {
+        return bundleContext;
+    }
+
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
+    public AppConfigurationEntry[] getEntries() {
+        if (this.entries == null && this.modules != null) {
+            Module[] modules = this.modules;
+            AppConfigurationEntry[] entries = new AppConfigurationEntry[modules.length];
+            for (int i = 0; i < modules.length; i++) {
+                Map<String,String> options = new HashMap<String,String>();
+                if (modules[i].getOptions() != null) {
+                    options.putAll(modules[i].getOptions());
+                }
+                options.put(ProxyLoginModule.PROPERTY_MODULE, modules[i].getClassName());
+                options.put(ProxyLoginModule.PROPERTY_BUNDLE, Long.toString(bundleContext.getBundle().getBundleId()));
+                entries[i] = new AppConfigurationEntry(ProxyLoginModule.class.getName(),
+                                                       getControlFlag(modules[i].getFlags()),
+                                                       options);
+            }
+            this.entries = entries;
+        }
+        return this.entries;
+    }
+
+    private AppConfigurationEntry.LoginModuleControlFlag getControlFlag(String flags) {
+        if ("required".equalsIgnoreCase(flags)) {
+            return AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
+        }
+        if ("optional".equalsIgnoreCase(flags)) {
+            return AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL;
+        }
+        if ("requisite".equalsIgnoreCase(flags)) {
+            return AppConfigurationEntry.LoginModuleControlFlag.REQUISITE;
+        }
+        if ("sufficient".equalsIgnoreCase(flags)) {
+            return AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT;
+        }
+        return null;
+    }
+}

Added: servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/JaasRealm.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/JaasRealm.java?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/JaasRealm.java (added)
+++ servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/JaasRealm.java Tue May 20 09:10:38 2008
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+package org.apache.servicemix.kernel.jaas.config;
+
+import javax.security.auth.login.AppConfigurationEntry;
+
+public interface JaasRealm {
+
+    public String getName();
+
+    public int getRank();
+
+    public AppConfigurationEntry[] getEntries();
+}

Added: servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/Module.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/Module.java?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/Module.java (added)
+++ servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/Module.java Tue May 20 09:10:38 2008
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+package org.apache.servicemix.kernel.jaas.config;
+
+import java.util.Map;
+
+/**
+ * POJO for a login module.
+ * It contains the class name, flags and a map of options.
+ */
+public class Module {
+
+    private String className;
+    private String flags;
+    private Map<String,String> options;
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+
+    public String getFlags() {
+        return flags;
+    }
+
+    public void setFlags(String flags) {
+        this.flags = flags;
+    }
+
+    public Map<String, String> getOptions() {
+        return options;
+    }
+
+    public void setOptions(Map<String, String> options) {
+        this.options = options;
+    }
+
+}

Added: servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/NamespaceHandler.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/NamespaceHandler.java?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/NamespaceHandler.java (added)
+++ servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/NamespaceHandler.java Tue May 20 09:10:38 2008
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+package org.apache.servicemix.kernel.jaas.config;
+
+import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import org.w3c.dom.Element;
+
+import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+import org.springframework.beans.factory.xml.BeanDefinitionParser;
+import org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser;
+import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.ManagedList;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.BeanDefinitionHolder;
+import org.springframework.beans.factory.parsing.BeanComponentDefinition;
+import org.springframework.util.xml.DomUtils;
+import org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean;
+import org.apache.servicemix.kernel.jaas.boot.ProxyLoginModule;
+
+public class NamespaceHandler extends NamespaceHandlerSupport {
+
+    public void init() {
+        registerBeanDefinitionParser("config", new ConfigParser());
+    }
+
+    protected class ConfigParser extends AbstractSingleBeanDefinitionParser {
+        protected Class getBeanClass(Element element) {
+            return Config.class;
+        }
+        protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
+            String name = element.getAttribute("name");
+            if (name == null || name.length() == 0) {
+                name = element.getAttribute("id");
+            }
+            builder.addPropertyValue("name", name);
+            String rank = element.getAttribute("rank");
+            if (rank != null && rank.length() > 0) {
+                builder.addPropertyValue("rank", Integer.parseInt(rank));
+            }
+            List childElements = DomUtils.getChildElementsByTagName(element, "module");
+            if (childElements != null && childElements.size() > 0) {
+                ManagedList children = new ManagedList(childElements.size());
+                BeanDefinitionParser parser = new ModuleParser();
+                for (int i = 0; i < childElements.size(); ++i) {
+                    Element childElement = (Element) childElements.get(i);
+                    BeanDefinitionBuilder bd = BeanDefinitionBuilder.genericBeanDefinition(Module.class);
+                    bd.addPropertyValue("className", childElement.getAttribute("className"));
+                    if (childElement.getAttribute("flags") != null) {
+                        bd.addPropertyValue("flags", childElement.getAttribute("flags"));
+                    }
+                    String options = DomUtils.getTextValue(childElement);
+                    if (options != null && options.length() > 0) {
+                        Properties props = new Properties();
+                        try {
+                            props.load(new ByteArrayInputStream(options.getBytes()));
+                        } catch (IOException e) {
+                            throw new IllegalStateException("Can not load options for JAAS module "
+                                            + childElement.getAttribute("className") + " in config " + name);
+                        }
+                        bd.addPropertyValue("options", props);
+                    }
+                    children.add(bd.getBeanDefinition());
+                }
+                builder.addPropertyValue("modules", children);
+            }
+            // Publish to OSGi
+            String publish = element.getAttribute("publish");
+            if (Boolean.valueOf(publish)) {
+                // Publish Config
+                BeanDefinitionBuilder bd = BeanDefinitionBuilder.genericBeanDefinition(OsgiServiceFactoryBean.class);
+                bd.addPropertyValue("target", builder.getBeanDefinition());
+                bd.addPropertyValue("interfaces", new Class[] { JaasRealm.class });
+                Map<String,String> props = new HashMap<String,String>();
+                props.put(ProxyLoginModule.PROPERTY_MODULE, name);
+                bd.addPropertyValue("serviceProperties", props);
+                BeanDefinition def = bd.getBeanDefinition();
+                String id = parserContext.getReaderContext().generateBeanName(def);
+                BeanDefinitionHolder holder = new BeanDefinitionHolder(def, id);
+                registerBeanDefinition(holder, parserContext.getRegistry());
+                if (shouldFireEvents()) {
+                    BeanComponentDefinition componentDefinition = new BeanComponentDefinition(holder);
+                    postProcessComponentDefinition(componentDefinition);
+                    parserContext.registerComponent(componentDefinition);
+                }
+            }
+        }
+    }
+
+    protected class ModuleParser extends AbstractSimpleBeanDefinitionParser {
+        protected Class getBeanClass(Element element) {
+            return Module.class;
+        }
+    }
+
+
+}

Added: servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/OsgiConfiguration.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/OsgiConfiguration.java?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/OsgiConfiguration.java (added)
+++ servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/OsgiConfiguration.java Tue May 20 09:10:38 2008
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+package org.apache.servicemix.kernel.jaas.config;
+
+import java.util.Map;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.security.auth.login.Configuration;
+import javax.security.auth.login.AppConfigurationEntry;
+
+public class OsgiConfiguration extends Configuration {
+
+    private List<JaasRealm> realms;
+
+    public void init() {
+        realms = new CopyOnWriteArrayList<JaasRealm>();
+        Configuration.setConfiguration(this);
+    }
+
+    public void close() {
+        realms.clear();
+        realms = null;
+        Configuration.setConfiguration(null);
+    }
+
+    public void register(JaasRealm realm, Map<String,?> properties) {
+        realms.add(realm);
+    }
+
+    public void unregister(JaasRealm realm, Map<String,?> properties) {
+        realms.remove(realm);
+    }
+
+    public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
+        JaasRealm realm = null;
+        for (JaasRealm r : realms) {
+            if (r.getName().equals(name)) {
+                if (realm == null || r.getRank() > realm.getRank()) {
+                    realm = r;
+                }
+            }
+        }
+        if (realm != null) {
+            return realm.getEntries();
+        }
+        return null;
+    }
+
+    public void refresh() {
+        // Nothing to do, as we auto-update the configuration
+    }
+}

Added: servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/ProxyLoginModuleInitializer.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/ProxyLoginModuleInitializer.java?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/ProxyLoginModuleInitializer.java (added)
+++ servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/java/org/apache/servicemix/kernel/jaas/config/ProxyLoginModuleInitializer.java Tue May 20 09:10:38 2008
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+package org.apache.servicemix.kernel.jaas.config;
+
+import org.osgi.framework.BundleContext;
+import org.apache.servicemix.kernel.jaas.boot.ProxyLoginModule;
+import org.springframework.osgi.context.BundleContextAware;
+
+public class ProxyLoginModuleInitializer implements BundleContextAware {
+
+    private BundleContext bundleContext;
+
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
+    public void init() {
+        BundleContext context = bundleContext.getBundle(0).getBundleContext();
+        ProxyLoginModule.init(context);
+    }
+}

Added: servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring.handlers
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring.handlers?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring.handlers (added)
+++ servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring.handlers Tue May 20 09:10:38 2008
@@ -0,0 +1,20 @@
+################################################################################
+#
+#    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.
+#
+################################################################################
+http\://servicemix.apache.org/jaas = org.apache.servicemix.kernel.jaas.config.NamespaceHandler
+ 
\ No newline at end of file

Added: servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring.schemas
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring.schemas?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring.schemas (added)
+++ servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring.schemas Tue May 20 09:10:38 2008
@@ -0,0 +1,19 @@
+################################################################################
+#
+#    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.
+#
+################################################################################
+http\://servicemix.apache.org/schema/servicemix-jaas.xsd = org/apache/servicemix/kernel/jaas/config/servicemix-jaas.xsd

Added: servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring/servicemix-jaas.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring/servicemix-jaas.xml?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring/servicemix-jaas.xml (added)
+++ servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/META-INF/spring/servicemix-jaas.xml Tue May 20 09:10:38 2008
@@ -0,0 +1,48 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.org/schema/osgi"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+  http://www.springframework.org/schema/beans
+  http://www.springframework.org/schema/beans/spring-beans.xsd
+  http://www.springframework.org/schema/util
+  http://www.springframework.org/schema/util/spring-util.xsd
+  http://www.springframework.org/schema/osgi
+  http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+    <bean id="config"
+          class="org.apache.servicemix.kernel.jaas.config.OsgiConfiguration"
+          init-method="init"
+          destroy-method="close"/>
+    <osgi:list id="realms"
+               interface="org.apache.servicemix.kernel.jaas.config.JaasRealm"
+               cardinality="0..N">
+        <osgi:listener ref="config"
+                       bind-method="register"
+                       unbind-method="unregister" />
+    </osgi:list>
+
+    <bean id="proxyLoginModuleInitializer"
+          class="org.apache.servicemix.kernel.jaas.config.ProxyLoginModuleInitializer"
+          init-method="init"/>
+
+</beans>

Added: servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/org/apache/servicemix/kernel/jaas/config/servicemix-jaas.xsd
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/org/apache/servicemix/kernel/jaas/config/servicemix-jaas.xsd?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/org/apache/servicemix/kernel/jaas/config/servicemix-jaas.xsd (added)
+++ servicemix/smx4/kernel/trunk/jaas/jaas-config/src/main/resources/org/apache/servicemix/kernel/jaas/config/servicemix-jaas.xsd Tue May 20 09:10:38 2008
@@ -0,0 +1,57 @@
+<?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.
+
+-->
+<xs:schema elementFormDefault='qualified'
+           targetNamespace='http://servicemix.apache.org/jaas'
+           xmlns:xs='http://www.w3.org/2001/XMLSchema'
+           xmlns:beans="http://www.springframework.org/schema/beans"
+           xmlns:tns='http://servicemix.apache.org/jaas'>
+
+    <xs:import namespace="http://www.springframework.org/schema/beans"/>
+
+    <xs:element name="config">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="beans:identifiedType">
+                    <xs:sequence>
+                        <xs:element name="module" minOccurs="0" maxOccurs="unbounded">
+                            <xs:complexType mixed="true">
+                                <xs:attribute name="className" use="required" type="xs:string" />
+                                <xs:attribute name="flags" default="required">
+                                    <xs:simpleType>
+                                        <xs:restriction base="xs:NMTOKEN">
+                                            <xs:enumeration value="required"/>
+                                            <xs:enumeration value="requisite"/>
+                                            <xs:enumeration value="sufficient"/>
+                                            <xs:enumeration value="optional"/>
+                                        </xs:restriction>
+                                    </xs:simpleType>
+                                </xs:attribute>
+                            </xs:complexType>
+                        </xs:element>
+                    </xs:sequence>
+                    <xs:attribute name="name" use="optional" type="xs:string" />
+                    <xs:attribute name="rank" use="optional" default="0" type="xs:int" />
+                    <xs:attribute name="publish" use="optional" default="true" type="xs:boolean" />
+                </xs:extension>
+            </xs:complexContent>
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>

Added: servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/java/org/apache/servicemix/kernel/jaas/config/NamespaceHandlerTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/java/org/apache/servicemix/kernel/jaas/config/NamespaceHandlerTest.java?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/java/org/apache/servicemix/kernel/jaas/config/NamespaceHandlerTest.java (added)
+++ servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/java/org/apache/servicemix/kernel/jaas/config/NamespaceHandlerTest.java Tue May 20 09:10:38 2008
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+package org.apache.servicemix.kernel.jaas.config;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.security.auth.login.AppConfigurationEntry;
+
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.osgi.context.support.BundleContextAwareProcessor;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.jmock.Mockery;
+import org.jmock.Expectations;
+import org.apache.servicemix.kernel.jaas.boot.ProxyLoginModule;
+import junit.framework.TestCase;
+
+public class NamespaceHandlerTest extends TestCase {
+
+    Mockery context = new Mockery();
+
+    public void testConfig() throws Exception {
+        final Dictionary headers = new Hashtable();
+        headers.put(Constants.BUNDLE_VERSION, "1.0.0.SNAPSHOT");
+        final BundleContext bundleContext = context.mock(BundleContext.class);
+        final Bundle bundle = context.mock(Bundle.class);
+
+        context.checking(new Expectations() {{
+            allowing(bundleContext).getBundle(); will(returnValue(bundle));
+            allowing(bundle).getSymbolicName(); will(returnValue("symbolic-name"));
+            allowing(bundle).getBundleId(); will(returnValue(Long.valueOf(32)));
+            allowing(bundle).getHeaders(); will(returnValue(headers));
+            one(bundleContext).registerService(with(any(String[].class)),
+                                               with(any(Config.class)),
+                                               with(any(Dictionary.class)));
+        }});
+        
+        AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { "classpath:config.xml" }, false) {
+            protected DefaultListableBeanFactory createBeanFactory() {
+                DefaultListableBeanFactory f = super.createBeanFactory();
+                f.addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
+                return f;
+            }
+        };
+        ctx.refresh();
+        Object obj = ctx.getBean("realm");
+        assertNotNull(obj);
+        assertTrue(obj instanceof Config);
+        Config cfg = (Config) obj;
+        assertNotNull(cfg.getBundleContext());
+        assertEquals("realm", cfg.getName());
+        assertNotNull(cfg.getModules());
+        assertEquals(1, cfg.getModules().length);
+        assertNotNull(cfg.getModules()[0]);
+        assertEquals("org.apache.servicemix.kernel.jaas.config.SimpleLoginModule", cfg.getModules()[0].getClassName());
+        assertEquals("required", cfg.getModules()[0].getFlags());
+        assertNotNull(cfg.getModules()[0].getOptions());
+        assertEquals(1, cfg.getModules()[0].getOptions().size());
+        assertEquals("value", cfg.getModules()[0].getOptions().get("key"));
+        AppConfigurationEntry[] entries = cfg.getEntries();
+        assertNotNull(entries);
+        assertEquals(1, entries.length);
+        assertNotNull(entries[0]);
+        assertEquals(ProxyLoginModule.class.getName(), entries[0].getLoginModuleName());
+        assertEquals(AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, entries[0].getControlFlag());
+        Map<String,?> options = entries[0].getOptions();
+        assertNotNull(options);
+        assertEquals(3, options.size());
+        assertEquals("value", options.get("key"));
+        assertEquals("org.apache.servicemix.kernel.jaas.config.SimpleLoginModule", options.get(ProxyLoginModule.PROPERTY_MODULE));
+        assertEquals("32", options.get(ProxyLoginModule.PROPERTY_BUNDLE));
+    }
+}

Added: servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/resources/config.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/resources/config.xml?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/resources/config.xml (added)
+++ servicemix/smx4/kernel/trunk/jaas/jaas-config/src/test/resources/config.xml Tue May 20 09:10:38 2008
@@ -0,0 +1,41 @@
+<?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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.org/schema/osgi"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xmlns:jaas="http://servicemix.apache.org/jaas"
+       xsi:schemaLocation="
+  http://www.springframework.org/schema/beans
+  http://www.springframework.org/schema/beans/spring-beans.xsd
+  http://www.springframework.org/schema/util
+  http://www.springframework.org/schema/util/spring-util.xsd
+  http://www.springframework.org/schema/osgi
+  http://www.springframework.org/schema/osgi/spring-osgi.xsd
+  http://servicemix.apache.org/jaas
+  http://servicemix.apache.org/schema/servicemix-jaas.xsd">
+
+    <jaas:config id="realm">
+        <jaas:module className="org.apache.servicemix.kernel.jaas.config.SimpleLoginModule" flags="required">
+            key=value
+        </jaas:module>
+    </jaas:config>
+
+</beans>

Added: servicemix/smx4/kernel/trunk/jaas/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/jaas/pom.xml?rev=658306&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/jaas/pom.xml (added)
+++ servicemix/smx4/kernel/trunk/jaas/pom.xml Tue May 20 09:10:38 2008
@@ -0,0 +1,41 @@
+<?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/maven-v4_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.servicemix.kernel</groupId>
+        <artifactId>kernel</artifactId>
+        <version>1.0-m4-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.kernel.jaas</groupId>
+    <artifactId>jaas</artifactId>
+    <packaging>pom</packaging>
+    <version>1.0-m4-SNAPSHOT</version>
+    <name>Apache ServiceMix Kernel :: JAAS</name>
+
+    <modules>
+        <module>jaas-boot</module>
+        <module>jaas-config</module>
+    </modules>
+
+</project>

Modified: servicemix/smx4/kernel/trunk/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/pom.xml?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/pom.xml Tue May 20 09:10:38 2008
@@ -41,6 +41,7 @@
     <module>testing</module>
     <module>gshell</module>
     <module>spring</module>
+    <module>jaas</module>
     <module>assembly</module>
   </modules>
 
@@ -52,7 +53,7 @@
   </scm>
   <issueManagement>
       <system>jira</system>
-      <url>http://issues.apache.org/activemq/browse/SM</url>
+      <url>http://issues.apache.org/activemq/browse/SMX4KNL</url>
   </issueManagement>
 
   <prerequisites>

Modified: servicemix/smx4/kernel/trunk/spring/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/spring/pom.xml?rev=658306&r1=658305&r2=658306&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/spring/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/spring/pom.xml Tue May 20 09:10:38 2008
@@ -68,6 +68,7 @@
           <instructions>
             <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
             <Private-Package>org.apache.servicemix.kernel.spring</Private-Package>
+            <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
           </instructions>
         </configuration>
       </plugin>