geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r232271 - in /geronimo/trunk/modules/tomcat/src: java/org/apache/geronimo/tomcat/TomcatContainer.java java/org/apache/geronimo/tomcat/TomcatWebAppContext.java test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
Date Fri, 12 Aug 2005 11:18:56 GMT
Author: jgenender
Date: Fri Aug 12 04:18:53 2005
New Revision: 232271

URL: http://svn.apache.org/viewcvs?rev=232271&view=rev
Log:
Added a default JAAS Realm if geronimo-web.xml contains a security-realm-name and a TomcatJAASRealm
with the same name does not exist

Modified:
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
    geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java?rev=232271&r1=232270&r2=232271&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
(original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
Fri Aug 12 04:18:53 2005
@@ -37,6 +37,7 @@
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.apache.geronimo.tomcat.realm.TomcatJAASRealm;
 import org.apache.geronimo.tomcat.util.SecurityHolder;
 import org.apache.geronimo.webservices.SoapHandler;
 import org.apache.geronimo.webservices.WebServiceContainer;
@@ -215,15 +216,31 @@
             //geronimo-web.xml file to be used if our Realm is a JAAS type
             if (securityRealmName != null){
                 if (realm instanceof JAASRealm){
-                    ((JAASRealm)realm).setAppName(secHolder.getSecurityRealm());
+                    ((JAASRealm)realm).setAppName(securityRealmName);
                 }
             }
             anotherCtxObj.setRealm(realm);
         } else {
+            Realm realm = host.getRealm();
+            //Check and see if we have a declared realm name and no match to a parent name
             if (securityRealmName != null){
-                log.warn("security-realm-name was specified but no RealmGBean was configured
for this context.  Ignoring security-realm-name.");
+                String parentRealmName = null;
+                if (realm instanceof JAASRealm){
+                    parentRealmName = ((JAASRealm)realm).getAppName();
+                }
+                if(!securityRealmName.equals(parentRealmName)){
+                    log.warn("The security-realm-name '" + securityRealmName + "' was specified
and a parent (Engine/Host) is not named the same or no RealmGBean was configured for this
context.  Creating a default TomcatJAASRealm adapter for this context.");
+                    TomcatJAASRealm jaasRealm = new TomcatJAASRealm();
+                    jaasRealm.setUserClassNames("org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal");
+                    jaasRealm.setRoleClassNames("org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal");
+                    jaasRealm.setAppName(securityRealmName);
+                    anotherCtxObj.setRealm(jaasRealm);
+                } else {
+                    anotherCtxObj.setRealm(realm);
+                }
+            } else {
+                anotherCtxObj.setRealm(realm);
             }
-            anotherCtxObj.setRealm(host.getRealm());
         }            
 
         host.addChild(anotherCtxObj);

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java?rev=232271&r1=232270&r2=232271&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
(original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
Fri Aug 12 04:18:53 2005
@@ -364,7 +364,7 @@
         // Is it necessary - doesn't Tomcat Embedded take care of it?
         // super.start();
 
-        log.info("TomcatWebAppContext started");
+        log.info("TomcatWebAppContext started for " + path);
     }
 
     public void doStop() throws Exception {

Modified: geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java?rev=232271&r1=232270&r2=232271&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
(original)
+++ geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
Fri Aug 12 04:18:53 2005
@@ -190,7 +190,7 @@
         securityHolder.setExcluded(componentPermissions.getExcludedPermissions());
         securityHolder.setPolicyContextID(POLICY_CONTEXT_ID);
         securityHolder.setDefaultPrincipal(defaultPrincipal);
-        securityHolder.setSecurityRealm(REALM_NAME);
+        securityHolder.setSecurityRealm("Geronimo");
         GBeanData app = new GBeanData(webModuleName, TomcatWebAppContext.GBEAN_INFO);
         app.setAttribute("classLoader", cl);
         app.setAttribute("webAppRoot", new File("target/var/catalina/webapps/war3/").toURI());



Mime
View raw message