geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: rev 71493 - in geronimo/trunk/modules: assembly assembly/src/plan assembly/src/var/config common/src/java/org/apache/geronimo/common connector connector/src/java/org/apache/geronimo/connector/outbound/security deployment/src/java/org/apache/geronimo/deployment/service jetty/src/java/org/apache/geronimo/jetty security/src/java/org/apache/geronimo/security security/src/java/org/apache/geronimo/security/jaas security/src/java/org/apache/geronimo/security/jacc security/src/java/org/apache/geronimo/security/realm security/src/java/org/apache/geronimo/security/realm/providers security/src/test/org/apache/geronimo/security/jaas
Date Mon, 15 Nov 2004 06:12:52 GMT
Author: ammulder
Date: Sun Nov 14 22:12:48 2004
New Revision: 71493

Added:
   geronimo/trunk/modules/common/src/java/org/apache/geronimo/common/GeronimoSecurityException.java
Modified:
   geronimo/trunk/modules/assembly/project.xml
   geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml
   geronimo/trunk/modules/assembly/src/var/config/config.list
   geronimo/trunk/modules/connector/project.xml
   geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/security/PasswordCredentialRealm.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
   geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppJACCContext.java
   geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyXMLConfiguration.java
   geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/SecurityService.java
   geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/SecurityServiceMBean.java
   geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LocalLoginModule.java
   geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginService.java
   geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginServiceMBean.java
   geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/RemoteLoginModule.java
   geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/RemoteLoginModuleRemoteWrapper.java
   geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/AbstractModuleConfiguration.java
   geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/ModuleConfiguration.java
   geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/SecurityRealm.java
   geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/KerberosSecurityRealm.java
   geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/PropertiesFileSecurityRealm.java
   geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/SQLLoginModule.java
   geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/SQLSecurityRealm.java
   geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/SimpleSecurityRealm.java
   geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/LoginSQLTest.java
Log:
Add JACC to the repository and the Server configuration
Add the Runtime Deployer to the default configuration
When setting GBean attributes on services, ignore leading/trailing whitespace
Move GeronimoSecurityException to common so both "client" and "server" can
  refer to it w/out loading all the classes in the Security JAR (which
  causes a variety of CL problems)
Support setting a driver for JDBC security realm


Modified: geronimo/trunk/modules/assembly/project.xml
==============================================================================
--- geronimo/trunk/modules/assembly/project.xml	(original)
+++ geronimo/trunk/modules/assembly/project.xml	Sun Nov 14 22:12:48 2004
@@ -318,6 +318,15 @@
         </dependency>
 
         <dependency>
+            <groupId>geronimo-spec</groupId>
+            <artifactId>geronimo-spec-j2ee-jacc</artifactId>
+            <version>&geronimo-spec-j2ee-jacc-version;</version>
+            <properties>
+                <repository>true</repository>
+            </properties>
+        </dependency>
+
+        <dependency>
             <groupId>geronimo</groupId>
             <artifactId>geronimo-j2ee-schema</artifactId>
             <version>${pom.currentVersion}</version>

Modified: geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml	(original)
+++ geronimo/trunk/modules/assembly/src/plan/j2ee-server-plan.xml	Sun Nov 14 22:12:48 2004
@@ -36,6 +36,9 @@
         <uri>geronimo-spec/jars/geronimo-spec-j2ee-${geronimo_spec_j2ee_version}.jar</uri>
     </dependency>
     <dependency>
+        <uri>geronimo-spec/jars/geronimo-spec-j2ee-jacc-${geronimo_spec_j2ee_jacc_version}.jar</uri>
+    </dependency>
+    <dependency>
         <uri>geronimo/jars/geronimo-j2ee-${geronimo_version}.jar</uri>
     </dependency>
     <dependency>

Modified: geronimo/trunk/modules/assembly/src/var/config/config.list
==============================================================================
--- geronimo/trunk/modules/assembly/src/var/config/config.list	(original)
+++ geronimo/trunk/modules/assembly/src/var/config/config.list	Sun Nov 14 22:12:48 2004
@@ -2,3 +2,4 @@
 org/apache/geronimo/Server
 org/apache/geronimo/SystemDatabase
 org/apache/geronimo/SystemJMS
+org/apache/geronimo/RuntimeDeployer

Added: geronimo/trunk/modules/common/src/java/org/apache/geronimo/common/GeronimoSecurityException.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/common/src/java/org/apache/geronimo/common/GeronimoSecurityException.java
Sun Nov 14 22:12:48 2004
@@ -0,0 +1,38 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.common;
+
+/**
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class GeronimoSecurityException extends RuntimeException {
+    public GeronimoSecurityException() {
+    }
+
+    public GeronimoSecurityException(String message) {
+        super(message);
+    }
+
+    public GeronimoSecurityException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public GeronimoSecurityException(Throwable cause) {
+        super(cause);
+    }
+}

Modified: geronimo/trunk/modules/connector/project.xml
==============================================================================
--- geronimo/trunk/modules/connector/project.xml	(original)
+++ geronimo/trunk/modules/connector/project.xml	Sun Nov 14 22:12:48 2004
@@ -68,6 +68,12 @@
 
         <dependency>
             <groupId>geronimo</groupId>
+            <artifactId>geronimo-common</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
             <artifactId>geronimo-kernel</artifactId>
             <version>${pom.currentVersion}</version>
         </dependency>

Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/security/PasswordCredentialRealm.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/security/PasswordCredentialRealm.java
(original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/security/PasswordCredentialRealm.java
Sun Nov 14 22:12:48 2004
@@ -26,7 +26,7 @@
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.security.GeronimoSecurityException;
+import org.apache.geronimo.common.GeronimoSecurityException;
 import org.apache.geronimo.security.realm.SecurityRealm;
 import org.apache.geronimo.security.realm.providers.AbstractSecurityRealm;
 import org.apache.regexp.RE;

Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
==============================================================================
--- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
(original)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
Sun Nov 14 22:12:48 2004
@@ -56,6 +56,9 @@
     }
 
     public void setAttribute(String name, String type, String text) throws DeploymentException
{
+        if(text != null) {
+            text = text.trim(); // avoid formatting errors due to extra whitespace in XML
configuration file
+        }
         try {
             // @todo we should not need all of common just for this
             if (type == null) {

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppJACCContext.java
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppJACCContext.java
(original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppJACCContext.java
Sun Nov 14 22:12:48 2004
@@ -46,7 +46,7 @@
 import org.apache.geronimo.gbean.WaitingException;
 import org.apache.geronimo.naming.java.ReadOnlyContext;
 import org.apache.geronimo.security.ContextManager;
-import org.apache.geronimo.security.GeronimoSecurityException;
+import org.apache.geronimo.common.GeronimoSecurityException;
 import org.apache.geronimo.security.IdentificationPrincipal;
 import org.apache.geronimo.security.PrimaryRealmPrincipal;
 import org.apache.geronimo.security.RealmPrincipal;

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyXMLConfiguration.java
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyXMLConfiguration.java
(original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyXMLConfiguration.java
Sun Nov 14 22:12:48 2004
@@ -38,7 +38,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import org.apache.geronimo.security.GeronimoSecurityException;
+import org.apache.geronimo.common.GeronimoSecurityException;
 import org.apache.geronimo.security.RealmPrincipal;
 import org.apache.geronimo.security.deploy.AutoMapAssistant;
 import org.apache.geronimo.security.deploy.Principal;

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/SecurityService.java
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/SecurityService.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/SecurityService.java
Sun Nov 14 22:12:48 2004
@@ -32,6 +32,7 @@
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.WaitingException;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
+import org.apache.geronimo.common.GeronimoSecurityException;
 import org.apache.geronimo.security.jacc.ModuleConfiguration;
 import org.apache.geronimo.security.jacc.PolicyContextHandlerContainerSubject;
 import org.apache.geronimo.security.jacc.PolicyContextHandlerHttpServletRequest;

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/SecurityServiceMBean.java
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/SecurityServiceMBean.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/SecurityServiceMBean.java
Sun Nov 14 22:12:48 2004
@@ -18,6 +18,7 @@
 package org.apache.geronimo.security;
 
 import java.util.Collection;
+import org.apache.geronimo.common.GeronimoSecurityException;
 
 
 /**

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LocalLoginModule.java
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LocalLoginModule.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LocalLoginModule.java
Sun Nov 14 22:12:48 2004
@@ -31,7 +31,7 @@
 
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.jmx.MBeanProxyFactory;
-import org.apache.geronimo.security.GeronimoSecurityException;
+import org.apache.geronimo.common.GeronimoSecurityException;
 import org.apache.geronimo.security.RealmPrincipal;
 
 

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginService.java
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginService.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginService.java
Sun Nov 14 22:12:48 2004
@@ -55,7 +55,7 @@
 import org.apache.geronimo.gbean.WaitingException;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.security.ContextManager;
-import org.apache.geronimo.security.GeronimoSecurityException;
+import org.apache.geronimo.common.GeronimoSecurityException;
 import org.apache.geronimo.security.IdentificationPrincipal;
 import org.apache.geronimo.security.RealmPrincipal;
 import org.apache.geronimo.security.SubjectId;

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginServiceMBean.java
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginServiceMBean.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/LoginServiceMBean.java
Sun Nov 14 22:12:48 2004
@@ -20,8 +20,7 @@
 import java.util.Collection;
 import javax.security.auth.Subject;
 import javax.security.auth.login.LoginException;
-
-import org.apache.geronimo.security.GeronimoSecurityException;
+import org.apache.geronimo.common.GeronimoSecurityException;
 
 
 /**

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/RemoteLoginModule.java
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/RemoteLoginModule.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/RemoteLoginModule.java
Sun Nov 14 22:12:48 2004
@@ -29,7 +29,7 @@
 import javax.security.auth.login.LoginException;
 import javax.security.auth.spi.LoginModule;
 
-import org.apache.geronimo.security.GeronimoSecurityException;
+import org.apache.geronimo.common.GeronimoSecurityException;
 import org.apache.geronimo.security.remoting.jmx.RemoteLoginServiceFactory;
 
 

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/RemoteLoginModuleRemoteWrapper.java
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/RemoteLoginModuleRemoteWrapper.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/RemoteLoginModuleRemoteWrapper.java
Sun Nov 14 22:12:48 2004
@@ -28,7 +28,7 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.geronimo.security.GeronimoSecurityException;
+import org.apache.geronimo.common.GeronimoSecurityException;
 import org.apache.geronimo.security.RealmPrincipal;
 
 

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/AbstractModuleConfiguration.java
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/AbstractModuleConfiguration.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/AbstractModuleConfiguration.java
Sun Nov 14 22:12:48 2004
@@ -26,7 +26,7 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.security.GeronimoSecurityException;
+import org.apache.geronimo.common.GeronimoSecurityException;
 
 
 /**

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/ModuleConfiguration.java
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/ModuleConfiguration.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jacc/ModuleConfiguration.java
Sun Nov 14 22:12:48 2004
@@ -20,7 +20,7 @@
 import java.util.Collection;
 import java.util.HashSet;
 
-import org.apache.geronimo.security.GeronimoSecurityException;
+import org.apache.geronimo.common.GeronimoSecurityException;
 
 
 /**
@@ -47,7 +47,7 @@
      * will cause a <code>PolicyContextException</code> to be thrown.
      * @param role The role that is to be mapped to a set of principals.
      * @param principals The set of principals that are to be mapped to to role.
-     * @throws org.apache.geronimo.security.GeronimoSecurityException if the mapping principals
to the same role twice occurs.
+     * @throws org.apache.geronimo.common.GeronimoSecurityException if the mapping principals
to the same role twice occurs.
      */
     public void addRoleMapping(String role, Collection principals) throws GeronimoSecurityException;
 
@@ -70,7 +70,7 @@
      * <code>EjbModuleConfigurationMBean</code> Object is "deleted" or "inService"
when this method is called.
      * @throws java.lang.IllegalArgumentException if called with an argument <code>EjbModuleConfigurationMBean</code>
      * whose Policy context is equivalent to that of this <code>EjbModuleConfigurationMBean</code>.
-     * @throws org.apache.geronimo.security.GeronimoSecurityException if the implementation
throws a checked exception that has not been accounted for by
+     * @throws org.apache.geronimo.common.GeronimoSecurityException if the implementation
throws a checked exception that has not been accounted for by
      * the linkConfiguration method signature. The exception thrown by the implementation
class will be encapsulated
      * (during construction) in the thrown <code>GeronimoSecurityException</code>.
      */
@@ -86,7 +86,7 @@
      * involving the deleted <code>PolicyConfiguration<code>.</p>
      * @throws java.lang.SecurityException if called by an <code>AccessControlContext</code>
that has not been granted
      * the "setPolicy" <code>SecurityPermission</code>.
-     * @throws org.apache.geronimo.security.GeronimoSecurityException if the implementation
throws a checked exception that has not been accounted for by
+     * @throws org.apache.geronimo.common.GeronimoSecurityException if the implementation
throws a checked exception that has not been accounted for by
      * the delete method signature. The exception thrown by the implementation class will
be encapsulated (during
      * construction) in the thrown <code>GeronimoSecurityException</code>.
      */
@@ -106,7 +106,7 @@
      * the "setPolicy" <code>SecurityPermission</code>.
      * @throws java.lang.UnsupportedOperationException if the state of the policy context
whose interface is this
      * <code>PolicyConfiguration</code> Object is "deleted" when this method
is called.
-     * @throws org.apache.geronimo.security.GeronimoSecurityException if the implementation
throws a checked exception that has not been accounted for by
+     * @throws org.apache.geronimo.common.GeronimoSecurityException if the implementation
throws a checked exception that has not been accounted for by
      * the commit method signature. The exception thrown by the implementation class will
be encapsulated (during
      * construction) in the thrown <code>GeronimoSecurityException</code>.
      */
@@ -119,7 +119,7 @@
      * otherwise.
      * @throws java.lang.SecurityException if called by an <code>AccessControlContext</code>
that has not been granted
      * the "setPolicy" <code>SecurityPermission</code>.
-     * @throws org.apache.geronimo.security.GeronimoSecurityException if the implementation
throws a checked exception that has not been accounted for by the
+     * @throws org.apache.geronimo.common.GeronimoSecurityException if the implementation
throws a checked exception that has not been accounted for by the
      * <code>inService</code> method signature. The exception thrown by the implementation
class will be encapsulated
      * (during construction) in the thrown <code>GeronimoSecurityException</code>.
      */

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/SecurityRealm.java
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/SecurityRealm.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/SecurityRealm.java
Sun Nov 14 22:12:48 2004
@@ -21,7 +21,7 @@
 
 import java.util.Set;
 
-import org.apache.geronimo.security.GeronimoSecurityException;
+import org.apache.geronimo.common.GeronimoSecurityException;
 import org.apache.regexp.RE;
 
 

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/KerberosSecurityRealm.java
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/KerberosSecurityRealm.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/KerberosSecurityRealm.java
Sun Nov 14 22:12:48 2004
@@ -25,7 +25,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.security.GeronimoSecurityException;
+import org.apache.geronimo.common.GeronimoSecurityException;
 import org.apache.regexp.RE;
 
 

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/PropertiesFileSecurityRealm.java
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/PropertiesFileSecurityRealm.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/PropertiesFileSecurityRealm.java
Sun Nov 14 22:12:48 2004
@@ -31,7 +31,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.security.GeronimoSecurityException;
+import org.apache.geronimo.common.GeronimoSecurityException;
 import org.apache.geronimo.security.deploy.Principal;
 import org.apache.geronimo.security.realm.AutoMapAssistant;
 import org.apache.geronimo.system.serverinfo.ServerInfo;

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/SQLLoginModule.java
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/SQLLoginModule.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/SQLLoginModule.java
Sun Nov 14 22:12:48 2004
@@ -18,15 +18,8 @@
 package org.apache.geronimo.security.realm.providers;
 
 import java.io.IOException;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
+import java.sql.*;
+import java.util.*;
 import javax.security.auth.Subject;
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.CallbackHandler;
@@ -47,8 +40,8 @@
     private String cbUsername;
     private String cbPassword;
     private String connectionURL;
-    private String sqlUser;
-    private String sqlPassword;
+    private Properties properties;
+    private Driver driver;
     private String userSelect;
     private String groupSelect;
     Set groups = new HashSet();
@@ -58,10 +51,10 @@
         this.handler = callbackHandler;
 
         connectionURL = (String) options.get(SQLSecurityRealm.CONNECTION_URL);
-        sqlUser = (String) options.get(SQLSecurityRealm.USERNAME);
-        sqlPassword = (String) options.get(SQLSecurityRealm.PASSWORD);
+        properties = (Properties) options.get(SQLSecurityRealm.PROPERTIES);
         userSelect = (String) options.get(SQLSecurityRealm.USER_SELECT);
         groupSelect = (String) options.get(SQLSecurityRealm.GROUP_SELECT);
+        driver = (Driver) options.get(SQLSecurityRealm.DRIVER);
     }
 
     public boolean login() throws LoginException {
@@ -81,7 +74,7 @@
 
         boolean found = false;
         try {
-            Connection conn = DriverManager.getConnection(connectionURL, sqlUser, sqlPassword);
+            Connection conn = driver.connect(connectionURL, properties);
 
             try {
                 PreparedStatement statement = conn.prepareStatement(userSelect);

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/SQLSecurityRealm.java
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/SQLSecurityRealm.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/SQLSecurityRealm.java
Sun Nov 14 22:12:48 2004
@@ -18,17 +18,8 @@
 package org.apache.geronimo.security.realm.providers;
 
 import javax.security.auth.login.AppConfigurationEntry;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
+import java.sql.*;
+import java.util.*;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -36,7 +27,7 @@
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.security.GeronimoSecurityException;
+import org.apache.geronimo.common.GeronimoSecurityException;
 import org.apache.geronimo.security.deploy.Principal;
 import org.apache.geronimo.security.realm.AutoMapAssistant;
 
@@ -51,15 +42,15 @@
     public final static String USER_SELECT = "org.apache.geronimo.security.realm.providers.SQLSecurityRealm.USER_SELECT";
     public final static String GROUP_SELECT = "org.apache.geronimo.security.realm.providers.SQLSecurityRealm.GROUP_SELECT";
     public final static String CONNECTION_URL = "org.apache.geronimo.security.realm.providers.SQLSecurityRealm.CONNECTION_URL";
-    public final static String USERNAME = "org.apache.geronimo.security.realm.providers.SQLSecurityRealm.USERNAME";
-    public final static String PASSWORD = "org.apache.geronimo.security.realm.providers.SQLSecurityRealm.PASSWORD";
+    public final static String PROPERTIES = "org.apache.geronimo.security.realm.providers.SQLSecurityRealm.PROPERTIES";
+    public final static String DRIVER = "org.apache.geronimo.security.realm.providers.SQLSecurityRealm.DRIVER";
 
     private boolean running = false;
     private String connectionURL;
-    private String user = "";
-    private String password = "";
     private String userSelect = "SELECT UserName, Password FROM Users";
     private String groupSelect = "SELECT GroupName, UserName FROM Groups";
+    private Driver driver;
+    private Properties properties;
     private final Map users = new HashMap();
     private final Map groups = new HashMap();
     private String defaultPrincipal;
@@ -70,13 +61,21 @@
     public SQLSecurityRealm() {
     }
 
-    public SQLSecurityRealm(String realmName, String connectionURL, String user, String password,
String userSelect, String groupSelect) {
+    public SQLSecurityRealm(String realmName, String driver, String connectionURL, String
user, String password, String userSelect, String groupSelect, ClassLoader classLoader) {
         super(realmName);
         this.connectionURL = connectionURL;
-        this.user = user;
-        this.password = password;
+        properties = new Properties();
+        properties.setProperty("user", user);
+        properties.setProperty("password", password);
         this.userSelect = userSelect;
         this.groupSelect = groupSelect;
+        try {
+            this.driver = (Driver) classLoader.loadClass(driver).newInstance();
+        } catch (ClassNotFoundException e) {
+            throw new IllegalArgumentException("Driver class "+driver+" is not available.
 Perhaps you need to add it as a dependency in your deployment plan?");
+        } catch(Exception e) {
+            throw new IllegalArgumentException("Unable to load, instantiate, register driver
"+driver+": "+e.getMessage());
+        }
     }
 
     public void doStart() {
@@ -101,68 +100,26 @@
         return connectionURL;
     }
 
-    public void setConnectionURL(String connectionURL) {
-        if (running) {
-            throw new IllegalStateException("Cannot change the Connection URI after the realm
is started");
-        }
-        this.connectionURL = connectionURL;
-    }
-
     public String getUser() {
-        return user;
-    }
-
-    public void setPassword(String password) {
-        if (running) {
-            throw new IllegalStateException("Cannot change the connection password after
the realm is started");
-        }
-        this.password = password;
+        return properties.getProperty("user");
     }
 
     public String getPassword() {
-        return password;
-    }
-
-    public void setUser(String user) {
-        if (running) {
-            throw new IllegalStateException("Cannot change the connection user after the
realm is started");
-        }
-        this.user = user;
+        return properties.getProperty("password");
     }
 
     public String getUserSelect() {
         return userSelect;
     }
 
-    public void setUserSelect(String userSelect) {
-        if (running) {
-            throw new IllegalStateException("Cannot change the user SQL select statement
after the realm is started");
-        }
-        this.userSelect = userSelect;
-    }
-
     public String getGroupSelect() {
         return groupSelect;
     }
 
-    public void setGroupSelect(String groupSelect) {
-        if (running) {
-            throw new IllegalStateException("Cannot change the group SQL select statement
after the realm is started");
-        }
-        this.groupSelect = groupSelect;
-    }
-
     public String getDefaultPrincipal() {
         return defaultPrincipal;
     }
 
-    public void setDefaultPrincipal(String defaultPrincipal) {
-        if (running) {
-            throw new IllegalStateException("Cannot change the default principal after the
realm is started");
-        }
-        this.defaultPrincipal = defaultPrincipal;
-    }
-
     public Set getGroupPrincipals() throws GeronimoSecurityException {
         if (!running) {
             throw new IllegalStateException("Cannot obtain Groups until the realm is started");
@@ -214,12 +171,15 @@
     }
 
     public void refresh() throws GeronimoSecurityException {
+        java.util.Enumeration e = DriverManager.getDrivers();
+        while(e.hasMoreElements()) {System.err.println("Refresh Driver: "+e.nextElement().getClass().getName());}
+
         users.clear();
         groups.clear();
         Map users = new HashMap();
         Map groups = new HashMap();
         try {
-            Connection conn = DriverManager.getConnection(connectionURL, user, password);
+            Connection conn = driver.connect(connectionURL, properties);
 
             try {
                 PreparedStatement statement = conn.prepareStatement(userSelect);
@@ -288,8 +248,8 @@
         options.put(USER_SELECT, userSelect);
         options.put(GROUP_SELECT, groupSelect);
         options.put(CONNECTION_URL, connectionURL);
-        options.put(USERNAME, user);
-        options.put(PASSWORD, password);
+        options.put(PROPERTIES, properties);
+        options.put(DRIVER, driver);
 
         AppConfigurationEntry entry = new AppConfigurationEntry("org.apache.geronimo.security.realm.providers.SQLLoginModule",
                                                                 AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT,
@@ -339,18 +299,22 @@
         infoFactory.addInterface(AutoMapAssistant.class);
         infoFactory.addAttribute("connectionURL", String.class, true);
         infoFactory.addAttribute("user", String.class, true);
+        infoFactory.addAttribute("driver", String.class, true);
         infoFactory.addAttribute("password", String.class, true);
         infoFactory.addAttribute("userSelect", String.class, true);
         infoFactory.addAttribute("groupSelect", String.class, true);
         infoFactory.addAttribute("defaultPrincipal", String.class, true);
+        infoFactory.addAttribute("classLoader", ClassLoader.class, false);
 
         infoFactory.setConstructor(new String[]{
             "realmName",
+            "driver",
             "connectionURL",
             "user",
             "password",
             "userSelect",
-            "groupSelect"});
+            "groupSelect",
+            "classLoader"});
 
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/SimpleSecurityRealm.java
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/SimpleSecurityRealm.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/realm/providers/SimpleSecurityRealm.java
Sun Nov 14 22:12:48 2004
@@ -26,7 +26,7 @@
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.security.GeronimoSecurityException;
+import org.apache.geronimo.common.GeronimoSecurityException;
 
 
 /**

Modified: geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/LoginSQLTest.java
==============================================================================
--- geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/LoginSQLTest.java
(original)
+++ geronimo/trunk/modules/security/src/test/org/apache/geronimo/security/jaas/LoginSQLTest.java
Sun Nov 14 22:12:48 2004
@@ -81,6 +81,7 @@
         gbean.setAttribute("realmName", "sql-realm");
         gbean.setAttribute("maxLoginModuleAge", new Long(1 * 1000));
         gbean.setAttribute("connectionURL", hsqldbURL);
+        gbean.setAttribute("driver","org.hsqldb.jdbcDriver");
         gbean.setAttribute("user", "loginmodule");
         gbean.setAttribute("password", "password");
         gbean.setAttribute("userSelect", "SELECT UserName, Password FROM Users");

Mime
View raw message