You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2010/04/09 19:47:24 UTC

svn commit: r932529 - in /geronimo/server/trunk: framework/buildsupport/car-maven-plugin/ framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ framework/configs/karaf-framework/ framework/configs/karaf-framework/s...

Author: djencks
Date: Fri Apr  9 17:47:23 2010
New Revision: 932529

URL: http://svn.apache.org/viewvc?rev=932529&view=rev
Log:
GERONIMO-5249 use Karaf's proxy login module to load login modules from correct bundles

Modified:
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/pom.xml
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java
    geronimo/server/trunk/framework/configs/karaf-framework/pom.xml
    geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/startup.properties
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundle.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundleContext.java
    geronimo/server/trunk/framework/modules/geronimo-security/pom.xml
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/JaasLoginModuleUse.java
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/GenericSecurityRealm.java
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/SQLLoginModule.java
    geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/credentialstore/SimpleCredentialStoreImplTest.java
    geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/AbstractLoginModuleTest.java
    geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/NoLoginModuleReuseTest.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/pom.xml?rev=932529&r1=932528&r2=932529&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/pom.xml (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/pom.xml Fri Apr  9 17:47:23 2010
@@ -233,6 +233,11 @@
             <scope>test</scope>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.felix.karaf.jaas</groupId>
+            <artifactId>org.apache.felix.karaf.jaas.boot</artifactId>
+            <version>1.5.0-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 
     <profiles>

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java?rev=932529&r1=932528&r2=932529&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java Fri Apr  9 17:47:23 2010
@@ -834,8 +834,10 @@ public abstract class AbstractCarMojo
                         "org.apache.geronimo.system.sharedlib," +
                         "org.apache.geronimo.system.threads," +
                         "org.apache.geronimo.system.util," +
-                        "org.apache.geronimo.mavenplugins.car" +
-                       "");
+                        "org.apache.geronimo.mavenplugins.car," +
+                        "org.apache.felix.karaf.jaas.boot;version=\"1.5.0\"," +
+                        "org.apache.yoko.rmispec.util"
+                );
                         /*
 
                         "org.apache.log4j;version=\"1.2.12\"," +

Modified: geronimo/server/trunk/framework/configs/karaf-framework/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/pom.xml?rev=932529&r1=932528&r2=932529&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/pom.xml (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/pom.xml Fri Apr  9 17:47:23 2010
@@ -32,6 +32,7 @@
 
     <properties>
         <felix.karaf.version>1.5.0-SNAPSHOT</felix.karaf.version>
+        <karaf.osgi.version>1.5.0</karaf.osgi.version>
 
         <!-- from karaf root pom -->
         <aopalliance.version>1.0_3</aopalliance.version>

Modified: geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/startup.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/startup.properties?rev=932529&r1=932528&r2=932529&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/startup.properties (original)
+++ geronimo/server/trunk/framework/configs/karaf-framework/src/main/filtered-resources/etc/startup.properties Fri Apr  9 17:47:23 2010
@@ -49,7 +49,7 @@ org/apache/felix/karaf/shell/org.apache.
 org/apache/felix/karaf/shell/org.apache.felix.karaf.shell.packages/${felix.karaf.version}/org.apache.felix.karaf.shell.packages-${felix.karaf.version}.jar=30
 org/apache/felix/karaf/shell/org.apache.felix.karaf.shell.commands/${felix.karaf.version}/org.apache.felix.karaf.shell.commands-${felix.karaf.version}.jar=30
 org/apache/felix/karaf/shell/org.apache.felix.karaf.shell.obr/${felix.karaf.version}/org.apache.felix.karaf.shell.obr-${felix.karaf.version}.jar=30
-org/apache/felix/karaf/jaas/org.apache.felix.karaf.jaas.boot/${felix.karaf.version}/org.apache.felix.karaf.jaas.boot-${felix.karaf.version}.jar=30
+#org/apache/felix/karaf/jaas/org.apache.felix.karaf.jaas.boot/${felix.karaf.version}/org.apache.felix.karaf.jaas.boot-${felix.karaf.version}.jar=30
 org/apache/felix/karaf/jaas/org.apache.felix.karaf.jaas.config/${felix.karaf.version}/org.apache.felix.karaf.jaas.config-${felix.karaf.version}.jar=30
 org/apache/felix/karaf/jaas/org.apache.felix.karaf.jaas.modules/${felix.karaf.version}/org.apache.felix.karaf.jaas.modules-${felix.karaf.version}.jar=30
 

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundle.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundle.java?rev=932529&r1=932528&r2=932529&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundle.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundle.java Fri Apr  9 17:47:23 2010
@@ -123,7 +123,7 @@ public class MockBundle implements Bundl
     }
 
     public String getSymbolicName() {
-        return null;
+        return location;
     }
 
     public Class loadClass(String s) throws ClassNotFoundException {

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundleContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundleContext.java?rev=932529&r1=932528&r2=932529&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundleContext.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundleContext.java Fri Apr  9 17:47:23 2010
@@ -67,11 +67,12 @@ public class MockBundleContext implement
         this.classLoader = null;
         configurationDatas = new HashMap<Artifact, ConfigurationData>();
         locations = new HashMap<String, Artifact>();
+        bundles.put(bundle.getBundleId(), bundle);
     }
 
     public MockBundleContext(ClassLoader classLoader, String location, Map<Artifact, ConfigurationData> configurationDatas, Map<String, Artifact> locationToArtifact) {
-        this.bundle = new MockBundle(classLoader, location, counter++);
-        bundles.put(counter, this.bundle);
+        this.bundle = new MockBundle(classLoader, location, counter);
+        bundles.put(counter++, this.bundle);
         this.classLoader = classLoader;
         ((MockBundle)bundle).setBundleContext(this);
         this.configurationDatas = configurationDatas == null? new HashMap<Artifact, ConfigurationData>(): configurationDatas;
@@ -100,8 +101,8 @@ public class MockBundleContext implement
         while (location.startsWith("/")) {
             location = location.substring(1);
         }
-        MockBundle bundle = new MockBundle(classLoader, location, counter++);
-        bundles.put(counter, bundle);
+        MockBundle bundle = new MockBundle(classLoader, location, counter);
+        bundles.put(counter++, bundle);
         //activate it.
         Artifact configId = getArtifactByLocation(location);
         ConfigurationData configurationData = configurationDatas.get(configId);

Modified: geronimo/server/trunk/framework/modules/geronimo-security/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/pom.xml?rev=932529&r1=932528&r2=932529&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/pom.xml (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/pom.xml Fri Apr  9 17:47:23 2010
@@ -66,6 +66,13 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.felix.karaf.jaas</groupId>
+            <artifactId>org.apache.felix.karaf.jaas.boot</artifactId>
+            <version>1.5.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
             <groupId>hsqldb</groupId>
             <artifactId>hsqldb</artifactId>
             <scope>test</scope>

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/JaasLoginModuleUse.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/JaasLoginModuleUse.java?rev=932529&r1=932528&r2=932529&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/JaasLoginModuleUse.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jaas/JaasLoginModuleUse.java Fri Apr  9 17:47:23 2010
@@ -25,11 +25,13 @@ import java.util.Set;
 
 import javax.security.auth.login.AppConfigurationEntry;
 
+import org.apache.felix.karaf.jaas.boot.ProxyLoginModule;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.security.SecurityNames;
+import org.osgi.framework.Bundle;
 
 
 /**
@@ -78,7 +80,7 @@ public class JaasLoginModuleUse implemen
         this.controlFlag = controlFlag;
     }
 
-    public void configure(Set<String> domainNames, List<AppConfigurationEntry> loginModuleConfigurations, String realmName, Kernel kernel, ServerInfo serverInfo, ClassLoader classLoader) throws ClassNotFoundException {
+    public void configure(Set<String> domainNames, List<AppConfigurationEntry> loginModuleConfigurations, String realmName, Kernel kernel, ServerInfo serverInfo, Bundle bundle) throws ClassNotFoundException {
         Map<String, ?> suppliedOptions = loginModule.getOptions();
         Map<String, Object> options;
         if (suppliedOptions != null) {
@@ -93,19 +95,20 @@ public class JaasLoginModuleUse implemen
             options.put(SERVERINFO_LM_OPTION, serverInfo);
         }
         if (!options.containsKey(CLASSLOADER_LM_OPTION)) {
-            options.put(CLASSLOADER_LM_OPTION, classLoader);
+            options.put(CLASSLOADER_LM_OPTION, bundle);
         }
         AppConfigurationEntry entry;
-        Class loginModuleClass;
-        loginModuleClass = classLoader.loadClass(loginModule.getLoginModuleClass());
-        options.put(WrappingLoginModule.CLASS_OPTION, loginModuleClass);
         if (loginModule.isWrapPrincipals()) {
+            Class loginModuleClass = bundle.loadClass(loginModule.getLoginModuleClass());
+            options.put(WrappingLoginModule.CLASS_OPTION, loginModuleClass);
             options.put(WrappingLoginModule.DOMAIN_OPTION, loginModule.getLoginDomainName());
             options.put(WrappingLoginModule.REALM_OPTION, realmName);
-            entry = new AppConfigurationEntry(WrappingLoginModule.class.getName(), controlFlag.getFlag(), options);
+            options.put(ProxyLoginModule.PROPERTY_MODULE, WrappingLoginModule.class.getName());
         } else {
-            entry = new AppConfigurationEntry(ClassOptionLoginModule.class.getName(), controlFlag.getFlag(), options);
+            options.put(ProxyLoginModule.PROPERTY_MODULE, loginModule.getLoginModuleClass());
         }
+        options.put(ProxyLoginModule.PROPERTY_BUNDLE, Long.toString(bundle.getBundleId()));
+        entry = new AppConfigurationEntry(ProxyLoginModule.class.getName(), controlFlag.getFlag(), options);
         if (loginModule.getLoginDomainName() != null) {
             if (domainNames.contains(loginModule.getLoginDomainName())) {
                 throw new IllegalStateException("Error in realm: one security realm cannot contain multiple login modules for the same login domain");
@@ -116,7 +119,7 @@ public class JaasLoginModuleUse implemen
         loginModuleConfigurations.add(entry);
 
         if (next != null) {
-            next.configure(domainNames, loginModuleConfigurations, realmName, kernel, serverInfo, classLoader);
+            next.configure(domainNames, loginModuleConfigurations, realmName, kernel, serverInfo, bundle);
         }
     }
 

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/GenericSecurityRealm.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/GenericSecurityRealm.java?rev=932529&r1=932528&r2=932529&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/GenericSecurityRealm.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/GenericSecurityRealm.java Fri Apr  9 17:47:23 2010
@@ -37,6 +37,7 @@ import org.apache.geronimo.security.jaas
 import org.apache.geronimo.security.jaas.SingleLoginConfiguration;
 import org.apache.geronimo.security.jaas.ConfigurationFactory;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.osgi.framework.Bundle;
 
 
 /**
@@ -71,7 +72,7 @@ public class GenericSecurityRealm implem
 
     private final boolean global;
     private final ServerInfo serverInfo;
-    private final ClassLoader classLoader;
+    private final Bundle bundle;
     private final Kernel kernel;
     private final Configuration configuration;
 
@@ -80,7 +81,7 @@ public class GenericSecurityRealm implem
                                 @ParamAttribute(name="wrapPrincipals")boolean wrapPrincipals,
                                 @ParamAttribute(name="global")boolean global,
                                 @ParamReference(name="ServerInfo")ServerInfo serverInfo,
-                                @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader,
+                                @ParamSpecial(type = SpecialAttributeType.bundle) Bundle bundle,
                                 @ParamSpecial(type = SpecialAttributeType.kernel)Kernel kernel
     ) throws ClassNotFoundException {
         this.realmName = realmName;
@@ -88,7 +89,7 @@ public class GenericSecurityRealm implem
         this.loginModuleUse = loginModuleUse;
         this.global = global;
         this.serverInfo = serverInfo;
-        this.classLoader = classLoader;
+        this.bundle = bundle;
         this.kernel = kernel;
 
         refresh();
@@ -139,7 +140,7 @@ public class GenericSecurityRealm implem
 
         if (loginModuleUse != null) {
             try {
-                loginModuleUse.configure(domainNames, loginModuleConfigurations, realmName, kernel, serverInfo, classLoader);
+                loginModuleUse.configure(domainNames, loginModuleConfigurations, realmName, kernel, serverInfo, bundle);
             } catch (ClassNotFoundException e) {
                 throw new IllegalStateException("can not configure realm", e);
             }

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/SQLLoginModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/SQLLoginModule.java?rev=932529&r1=932528&r2=932529&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/SQLLoginModule.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/realm/providers/SQLLoginModule.java Fri Apr  9 17:47:23 2010
@@ -47,6 +47,7 @@ import javax.security.auth.spi.LoginModu
 import javax.sql.DataSource;
 
 import org.apache.geronimo.kernel.NoSuchOperationException;
+import org.osgi.framework.Bundle;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.geronimo.gbean.AbstractName;
@@ -183,7 +184,7 @@ public class SQLLoginModule implements L
             if (options.get(PASSWORD) != null) {
                 properties.put("password", options.get(PASSWORD));
             }
-            ClassLoader cl = (ClassLoader) options.get(JaasLoginModuleUse.CLASSLOADER_LM_OPTION);
+            Bundle cl = (Bundle) options.get(JaasLoginModuleUse.CLASSLOADER_LM_OPTION);
             try {
                 driver = (Driver) cl.loadClass((String) options.get(DRIVER)).newInstance();
             } catch (ClassNotFoundException e) {

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/credentialstore/SimpleCredentialStoreImplTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/credentialstore/SimpleCredentialStoreImplTest.java?rev=932529&r1=932528&r2=932529&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/credentialstore/SimpleCredentialStoreImplTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/credentialstore/SimpleCredentialStoreImplTest.java Fri Apr  9 17:47:23 2010
@@ -27,8 +27,11 @@ import java.util.Collections;
 
 import javax.security.auth.Subject;
 
+import org.apache.felix.karaf.jaas.boot.ProxyLoginModule;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.osgi.MockBundle;
+import org.apache.geronimo.kernel.osgi.MockBundleContext;
 import org.apache.geronimo.security.AbstractTest;
 import org.apache.geronimo.security.jaas.DirectConfigurationEntry;
 import org.apache.geronimo.security.jaas.JaasLoginModuleUse;
@@ -38,11 +41,13 @@ import org.apache.geronimo.security.jaas
 import org.apache.geronimo.security.realm.GenericSecurityRealm;
 import org.apache.geronimo.security.realm.providers.PropertiesFileLoginModule;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.osgi.framework.Bundle;
 
 /**
  * @version $Rev$ $Date$
  */
 public class SimpleCredentialStoreImplTest extends AbstractTest {
+    private Bundle bundle = new MockBundle(getClass().getClassLoader(), "", 1);
     protected AbstractName clientLM;
     protected AbstractName clientCE;
     protected AbstractName testCE;
@@ -50,6 +55,7 @@ public class SimpleCredentialStoreImplTe
     private GenericSecurityRealm gsr;
 
     public void setUp() throws Exception {
+        ProxyLoginModule.init(new MockBundleContext(bundle));
         needServerInfo = true;
         needLoginConfiguration = false;
         super.setUp();
@@ -61,7 +67,7 @@ public class SimpleCredentialStoreImplTe
 
         JaasLoginModuleUse lmu = new JaasLoginModuleUse(lm, null, LoginModuleControlFlag.REQUIRED);
 
-        gsr = new GenericSecurityRealm("properties-realm", lmu, false, true, (ServerInfo) kernel.getGBean(serverInfo), getClass().getClassLoader(), kernel);
+        gsr = new GenericSecurityRealm("properties-realm", lmu, false, true, (ServerInfo) kernel.getGBean(serverInfo), bundle, kernel);
 
     }
 

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/AbstractLoginModuleTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/AbstractLoginModuleTest.java?rev=932529&r1=932528&r2=932529&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/AbstractLoginModuleTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/AbstractLoginModuleTest.java Fri Apr  9 17:47:23 2010
@@ -20,6 +20,7 @@
 
 package org.apache.geronimo.security.jaas;
 
+import org.apache.felix.karaf.jaas.boot.ProxyLoginModule;
 import org.apache.geronimo.security.AbstractTest;
 import org.apache.geronimo.security.realm.GenericSecurityRealm;
 import org.apache.geronimo.gbean.GBeanData;
@@ -41,6 +42,7 @@ public abstract class AbstractLoginModul
         needServerInfo = true;
         needLoginConfiguration = true;
         super.setUp();
+        ProxyLoginModule.init(bundleContext);
 
         GBeanData gbean;
 

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/NoLoginModuleReuseTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/NoLoginModuleReuseTest.java?rev=932529&r1=932528&r2=932529&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/NoLoginModuleReuseTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/jaas/NoLoginModuleReuseTest.java Fri Apr  9 17:47:23 2010
@@ -31,8 +31,11 @@ import javax.security.auth.login.LoginEx
 import javax.security.auth.spi.LoginModule;
 
 import junit.framework.TestCase;
+import org.apache.felix.karaf.jaas.boot.ProxyLoginModule;
+import org.apache.geronimo.kernel.osgi.MockBundleContext;
 import org.apache.geronimo.security.realm.GenericSecurityRealm;
 import org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal;
+import org.osgi.framework.BundleContext;
 
 
 /**
@@ -40,7 +43,10 @@ import org.apache.geronimo.security.real
  */
 public class NoLoginModuleReuseTest extends TestCase {
 
+    private BundleContext bundleContext = new MockBundleContext(getClass().getClassLoader(), "", null, null);
+
     public void testNoLoginModuleReuse() throws Exception {
+        ProxyLoginModule.init(bundleContext);
         doTest(true, "realm1");
         doTest(false, "realm2");
     }
@@ -53,7 +59,7 @@ public class NoLoginModuleReuseTest exte
                 wrapPrincipals,
                 true,
                 null,
-                getClass().getClassLoader(),
+                bundleContext.getBundle(),
                 null);
         GeronimoLoginConfiguration loginConfig = new GeronimoLoginConfiguration(Collections.<ConfigurationEntryFactory>singleton(realm), false);
         doLogin(loginConfig, realmName);

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java?rev=932529&r1=932528&r2=932529&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java Fri Apr  9 17:47:23 2010
@@ -21,6 +21,7 @@ import org.apache.geronimo.connector.out
 import org.apache.geronimo.j2ee.jndi.ContextSource;
 import org.apache.geronimo.j2ee.jndi.WebContextSource;
 import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.osgi.MockBundle;
 import org.apache.geronimo.kernel.osgi.MockBundleContext;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.security.SecurityServiceImpl;
@@ -159,7 +160,8 @@ public abstract class AbstractWebModuleT
 
         PrincipalInfo.PrincipalEditor principalEditor = new PrincipalInfo.PrincipalEditor();
         principalEditor.setAsText("metro,org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal");
-        realm = new GenericSecurityRealm(domainName, loginModuleUse, true, true, serverInfo,  cl, null);
+        Bundle bundle = new MockBundle(cl, "", -1);
+        realm = new GenericSecurityRealm(domainName, loginModuleUse, true, true, serverInfo, bundle, null);
     }