geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r327647 - in /geronimo/trunk/modules/security/src: java/org/apache/geronimo/security/jaas/ java/org/apache/geronimo/security/jaas/server/ java/org/apache/geronimo/security/realm/ test/org/apache/geronimo/security/jaas/
Date Sat, 22 Oct 2005 09:05:07 GMT
Author: djencks
Date: Sat Oct 22 02:05:00 2005
New Revision: 327647

URL: http://svn.apache.org/viewcvs?rev=327647&view=rev
Log:
GERONIMO-1044. Use the LoginModuleGBean's gbean classloader to instantiate the login module,
unless it has been lost through serialization

Modified:
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/DirectConfigurationEntry.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/JaasLoginModuleUse.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginModuleGBean.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginUtils.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/ServerRealmConfigurationEntry.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginModuleConfiguration.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/GenericSecurityRealm.java
    geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/MultipleLoginDomainTest.java
    geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/NoLoginModuleReuseTest.java

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/DirectConfigurationEntry.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/DirectConfigurationEntry.java?rev=327647&r1=327646&r2=327647&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/DirectConfigurationEntry.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/DirectConfigurationEntry.java
Sat Oct 22 02:05:00 2005
@@ -55,7 +55,7 @@
     }
 
     public JaasLoginModuleConfiguration generateConfiguration() {
-        return new JaasLoginModuleConfiguration(module.getLoginModuleClass(), controlFlag,
module.getOptions(), module.isServerSide(), applicationConfigName, wrapPrincipals);
+        return new JaasLoginModuleConfiguration(module.getLoginModuleClass(), controlFlag,
module.getOptions(), module.isServerSide(), applicationConfigName, wrapPrincipals, module.getClassLoader());
     }
 
     public static final GBeanInfo GBEAN_INFO;

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/JaasLoginModuleUse.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/JaasLoginModuleUse.java?rev=327647&r1=327646&r2=327647&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/JaasLoginModuleUse.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/JaasLoginModuleUse.java
Sat Oct 22 02:05:00 2005
@@ -94,7 +94,7 @@
                 domainNames.add(loginModule.getLoginDomainName());
             }
         }
-        JaasLoginModuleConfiguration config = new JaasLoginModuleConfiguration(loginModule.getLoginModuleClass(),
controlFlag, options, loginModule.isServerSide(), loginModule.getLoginDomainName(), loginModule.isWrapPrincipals());
+        JaasLoginModuleConfiguration config = new JaasLoginModuleConfiguration(loginModule.getLoginModuleClass(),
controlFlag, options, loginModule.isServerSide(), loginModule.getLoginDomainName(), loginModule.isWrapPrincipals(),
loginModule.getClassLoader());
         loginModuleConfigurations.add(config);
 
         if (next != null) {

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginModuleGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginModuleGBean.java?rev=327647&r1=327646&r2=327647&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginModuleGBean.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginModuleGBean.java
Sat Oct 22 02:05:00 2005
@@ -39,15 +39,18 @@
     private String objectName;
     private boolean serverSide;
     private boolean wrapPrincipals;
+    private final ClassLoader classLoader;
 
     public LoginModuleGBean() {
+        this.classLoader = null;
     }
 
-    public LoginModuleGBean(String loginModuleClass, String objectName, boolean serverSide,
boolean wrapPrincipals) {
+    public LoginModuleGBean(String loginModuleClass, String objectName, boolean serverSide,
boolean wrapPrincipals, ClassLoader classLoader) {
         this.loginModuleClass = loginModuleClass;
         this.objectName = objectName;
         this.serverSide = serverSide;
         this.wrapPrincipals = wrapPrincipals;
+        this.classLoader = classLoader;
     }
 
     public String getLoginDomainName() {
@@ -98,6 +101,10 @@
         this.wrapPrincipals = wrapPrincipals;
     }
 
+    public ClassLoader getClassLoader() {
+        return classLoader;
+    }
+
     public static final GBeanInfo GBEAN_INFO;
 
     static {
@@ -108,7 +115,8 @@
         infoFactory.addAttribute("serverSide", boolean.class, true);
         infoFactory.addAttribute("loginDomainName", String.class, true);
         infoFactory.addAttribute("wrapPrincipals", boolean.class, true);
-        infoFactory.setConstructor(new String[]{"loginModuleClass", "objectName", "serverSide",
"wrapPrincipals"});
+        infoFactory.addAttribute("classLoader", ClassLoader.class, false);
+        infoFactory.setConstructor(new String[]{"loginModuleClass", "objectName", "serverSide",
"wrapPrincipals", "classLoader"});
 
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginUtils.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginUtils.java?rev=327647&r1=327646&r2=327647&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginUtils.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginUtils.java
Sat Oct 22 02:05:00 2005
@@ -69,10 +69,11 @@
      */
     public static JaasLoginModuleConfiguration getSerializableCopy(JaasLoginModuleConfiguration
config) {
         return new JaasLoginModuleConfiguration(config.getLoginModuleClassName(),
-                                                config.getFlag(),
-                                                LoginUtils.getSerializableCopy(config.getOptions()),
-                                                config.isServerSide(),
-                                                config.getLoginDomainName(),
-                                                config.isWrapPrincipals());
+                config.getFlag(),
+                LoginUtils.getSerializableCopy(config.getOptions()),
+                config.isServerSide(),
+                config.getLoginDomainName(),
+                config.isWrapPrincipals(),
+                null);
     }
 }

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/ServerRealmConfigurationEntry.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/ServerRealmConfigurationEntry.java?rev=327647&r1=327646&r2=327647&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/ServerRealmConfigurationEntry.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/ServerRealmConfigurationEntry.java
Sat Oct 22 02:05:00 2005
@@ -85,7 +85,7 @@
         options.put("realm", realmName);
         options.put("kernel", kernel.getKernelName());
 
-        return new JaasLoginModuleConfiguration(JaasLoginCoordinator.class.getName(), LoginModuleControlFlag.REQUIRED,
options, true, applicationConfigName, wrapPrincipals);
+        return new JaasLoginModuleConfiguration(JaasLoginCoordinator.class.getName(), LoginModuleControlFlag.REQUIRED,
options, true, applicationConfigName, wrapPrincipals, JaasLoginCoordinator.class.getClassLoader());
     }
 
     public static final GBeanInfo GBEAN_INFO;

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginModuleConfiguration.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginModuleConfiguration.java?rev=327647&r1=327646&r2=327647&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginModuleConfiguration.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginModuleConfiguration.java
Sat Oct 22 02:05:00 2005
@@ -38,9 +38,10 @@
     private final String loginModuleName;
     private final Map options;
     private final boolean wrapPrincipals;
+    private final transient ClassLoader classLoader;
 
     public JaasLoginModuleConfiguration(String loginModuleName, LoginModuleControlFlag flag,
Map options,
-                                        boolean serverSide, String loginDomainName, boolean
wrapPrincipals)
+                                        boolean serverSide, String loginDomainName, boolean
wrapPrincipals, ClassLoader classLoader)
     {
         this.serverSide = serverSide;
         this.flag = flag;
@@ -48,10 +49,11 @@
         this.options = options;
         this.loginDomainName = loginDomainName;
         this.wrapPrincipals = wrapPrincipals;
+        this.classLoader = classLoader;
     }
 
-    public JaasLoginModuleConfiguration(String loginModuleName, LoginModuleControlFlag flag,
Map options, boolean serverSide) {
-        this(loginModuleName, flag, options, serverSide, null, false);
+    public JaasLoginModuleConfiguration(String loginModuleName, LoginModuleControlFlag flag,
Map options, boolean serverSide, ClassLoader classLoader) {
+        this(loginModuleName, flag, options, serverSide, null, false, classLoader);
     }
 
     public String getLoginModuleClassName() {
@@ -59,6 +61,10 @@
     }
 
     public LoginModule getLoginModule(ClassLoader loader) throws GeronimoSecurityException
{
+        //TODO determine if this is ever called after serialization: if not the classloader
passed in is unnecessary.
+        if (classLoader != null) {
+            loader = classLoader;
+        }
         try {
             return (LoginModule) loader.loadClass(loginModuleName).newInstance();
         } catch (Exception e) {

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java?rev=327647&r1=327646&r2=327647&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java
Sat Oct 22 02:05:00 2005
@@ -350,7 +350,6 @@
         }
         JaasSessionId sessionHandle = new JaasSessionId(id, hash(id));
         JaasLoginModuleConfiguration[] modules = realm.getAppConfigurationEntries();
-        //TODO use of this classloader severely limits extensibility!!!
         JaasSecuritySession session = new JaasSecuritySession(realm.getRealmName(), modules,
new HashMap(), classLoader);
         activeLogins.put(sessionHandle, session);
         return sessionHandle;

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/GenericSecurityRealm.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/GenericSecurityRealm.java?rev=327647&r1=327646&r2=327647&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/GenericSecurityRealm.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/GenericSecurityRealm.java
Sat Oct 22 02:05:00 2005
@@ -171,7 +171,7 @@
             options.put(JaasLoginCoordinator.OPTION_SERVICENAME, loginService.getObjectName());
         }
 
-        return new JaasLoginModuleConfiguration(JaasLoginCoordinator.class.getName(), LoginModuleControlFlag.REQUIRED,
options, true, realmName, wrapPrincipals);
+        return new JaasLoginModuleConfiguration(JaasLoginCoordinator.class.getName(), LoginModuleControlFlag.REQUIRED,
options, true, realmName, wrapPrincipals, JaasLoginCoordinator.class.getClassLoader());
     }
 
     public static final GBeanInfo GBEAN_INFO;

Modified: geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/MultipleLoginDomainTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/MultipleLoginDomainTest.java?rev=327647&r1=327646&r2=327647&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/MultipleLoginDomainTest.java
(original)
+++ geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/MultipleLoginDomainTest.java
Sat Oct 22 02:05:00 2005
@@ -47,10 +47,10 @@
      * @throws Exception
      */
     public void testMultipleLoginDomains() throws Exception {
-        JaasLoginModuleConfiguration m1 = new JaasLoginModuleConfiguration(MockLoginModule.class.getName(),
LoginModuleControlFlag.REQUIRED, new HashMap(), true, "D1", true);
-        JaasLoginModuleConfiguration m2 = new JaasLoginModuleConfiguration(MockLoginModule.class.getName(),
LoginModuleControlFlag.REQUIRED, new HashMap(), true, "D2", true);
-        JaasLoginModuleConfiguration m3 = new JaasLoginModuleConfiguration(AnotherMockLoginModule.class.getName(),
LoginModuleControlFlag.REQUIRED, new HashMap(), false, "D3", false);
-        JaasLoginModuleConfiguration m4 = new JaasLoginModuleConfiguration(AnotherMockLoginModule.class.getName(),
LoginModuleControlFlag.REQUIRED, new HashMap(), false, "D4", true);
+        JaasLoginModuleConfiguration m1 = new JaasLoginModuleConfiguration(MockLoginModule.class.getName(),
LoginModuleControlFlag.REQUIRED, new HashMap(), true, "D1", true, MockLoginModule.class.getClassLoader());
+        JaasLoginModuleConfiguration m2 = new JaasLoginModuleConfiguration(MockLoginModule.class.getName(),
LoginModuleControlFlag.REQUIRED, new HashMap(), true, "D2", true, MockLoginModule.class.getClassLoader());
+        JaasLoginModuleConfiguration m3 = new JaasLoginModuleConfiguration(AnotherMockLoginModule.class.getName(),
LoginModuleControlFlag.REQUIRED, new HashMap(), false, "D3", false, AnotherMockLoginModule.class.getClassLoader());
+        JaasLoginModuleConfiguration m4 = new JaasLoginModuleConfiguration(AnotherMockLoginModule.class.getName(),
LoginModuleControlFlag.REQUIRED, new HashMap(), false, "D4", true, AnotherMockLoginModule.class.getClassLoader());
         JaasSecuritySession c = new JaasSecuritySession("realm", new JaasLoginModuleConfiguration[]{m1,
m2, m3, m4}, new HashMap(), this.getClass().getClassLoader());
         Subject s = c.getSubject();
 

Modified: geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/NoLoginModuleReuseTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/NoLoginModuleReuseTest.java?rev=327647&r1=327646&r2=327647&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/NoLoginModuleReuseTest.java
(original)
+++ geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/NoLoginModuleReuseTest.java
Sat Oct 22 02:05:00 2005
@@ -36,7 +36,7 @@
 public class NoLoginModuleReuseTest extends TestCase {
 
     public void testNoLoginModuleReuse() throws Exception {
-        JaasLoginModuleConfiguration m1 = new JaasLoginModuleConfiguration(MockLoginModule.class.getName(),
LoginModuleControlFlag.REQUIRED, new HashMap(), true, "D1", true);
+        JaasLoginModuleConfiguration m1 = new JaasLoginModuleConfiguration(MockLoginModule.class.getName(),
LoginModuleControlFlag.REQUIRED, new HashMap(), true, "D1", true, MockLoginModule.class.getClassLoader());
         doSecurityContextLogin(m1);
         doSecurityContextLogin(m1);
     }



Mime
View raw message