geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r332225 - in /geronimo/trunk/modules: jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Date Thu, 10 Nov 2005 05:33:08 GMT
Author: djencks
Date: Wed Nov  9 21:33:02 2005
New Revision: 332225

URL: http://svn.apache.org/viewcvs?rev=332225&view=rev
Log:
GERONIMO-1150  Provide a couple of explanatory exceptions if you provide incomplete security
information

Modified:
    geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
    geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java

Modified: geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=332225&r1=332224&r2=332225&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
(original)
+++ geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
Wed Nov  9 21:33:02 2005
@@ -422,6 +422,13 @@
         GerMessageDestinationType[] gerMessageDestinations = gerWebApp.getMessageDestinationArray();
 
         ENCConfigBuilder.registerMessageDestinations(earContext.getRefContext(), module.getName(),
messageDestinations, gerMessageDestinations);
+        if (gerWebApp.isSetSecurity()) {
+            if (!gerWebApp.isSetSecurityRealmName()) {
+                throw new DeploymentException("You have supplied a security configuration
for web app " + module.getName() + " but no security-realm-name to allow login");
+            }
+            SecurityConfiguration securityConfiguration = SecurityBuilder.buildSecurityConfiguration(gerWebApp.getSecurity());
+            earContext.setSecurityConfiguration(securityConfiguration);
+        }
     }
 
     public void addGBeans(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException
{
@@ -783,9 +790,11 @@
             addServlets(webModuleName, webModule.getModuleFile(), servletTypes, servletMappings,
securityRoles, rolePermissions, portMap, webClassLoader, moduleJ2eeContext, earContext);
 
             if (jettyWebApp.isSetSecurityRealmName()) {
+                if (earContext.getSecurityConfiguration() == null) {
+                     throw new DeploymentException("You have specified a login security realm
for the webapp " + webModuleName + " but no security configuration is supplied in the application
plan");
+                }
                 String securityRealmName = jettyWebApp.getSecurityRealmName().trim();
                 webModuleData.setAttribute("securityRealmName", securityRealmName);
-//                webModuleData.setAttribute("securityConfig", security);
 
                 /**
                  * TODO - go back to commented version when possible.
@@ -793,7 +802,6 @@
                 String policyContextID = webModuleName.getCanonicalName().replaceAll("[,
:]", "_");
                 //String policyContextID = webModuleName.getCanonicalName();
                 webModuleData.setAttribute("policyContextID", policyContextID);
-//                webModuleData.setAttribute("securityRoles", securityRoles);
 
                 ComponentPermissions componentPermissions = buildSpecSecurityConfig(webApp,
securityRoles, rolePermissions);
                 webModuleData.setAttribute("excludedPermissions", componentPermissions.getExcludedPermissions());
@@ -808,10 +816,6 @@
                 webModuleData.setAttribute("checkedPermissions", checkedPermissions);
 
                 earContext.addSecurityContext(policyContextID, componentPermissions);
-                if (jettyWebApp.isSetSecurity()) {
-                    SecurityConfiguration securityConfiguration = SecurityBuilder.buildSecurityConfiguration(jettyWebApp.getSecurity());
-                    earContext.setSecurityConfiguration(securityConfiguration);
-                }
                 DefaultPrincipal defaultPrincipal = earContext.getSecurityConfiguration().getDefaultPrincipal();
                 webModuleData.setAttribute("defaultPrincipal", defaultPrincipal);
 

Modified: geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=332225&r1=332224&r2=332225&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/trunk/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Wed Nov  9 21:33:02 2005
@@ -374,6 +374,13 @@
         GerMessageDestinationType[] gerMessageDestinations = gerWebApp.getMessageDestinationArray();
 
         ENCConfigBuilder.registerMessageDestinations(earContext.getRefContext(), module.getName(),
messageDestinations, gerMessageDestinations);
+        if (gerWebApp.isSetSecurity()) {
+            if (!gerWebApp.isSetSecurityRealmName()) {
+                throw new DeploymentException("You have supplied a security configuration
for web app " + module.getName() + " but no security-realm-name to allow login");
+            }
+            SecurityConfiguration securityConfiguration = SecurityBuilder.buildSecurityConfiguration(gerWebApp.getSecurity());
+            earContext.setSecurityConfiguration(securityConfiguration);
+        }
     }
 
     public void addGBeans(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException
{
@@ -498,6 +505,9 @@
             webModuleData.setAttribute("webServices", webServices);
 
             if (tomcatWebApp.isSetSecurityRealmName()) {
+                if (earContext.getSecurityConfiguration() == null) {
+                     throw new DeploymentException("You have specified a login security realm
for the webapp " + webModuleName + " but no security configuration is supplied in the application
plan");
+                }
 
                 SecurityHolder securityHolder = new SecurityHolder();
                 securityHolder.setSecurityRealm(tomcatWebApp.getSecurityRealmName().trim());
@@ -520,10 +530,6 @@
                 }
                 securityHolder.setChecked(checkedPermissions);
                 earContext.addSecurityContext(policyContextID, componentPermissions);
-                if (tomcatWebApp.isSetSecurity()) {
-                    SecurityConfiguration securityConfiguration = SecurityBuilder.buildSecurityConfiguration(tomcatWebApp.getSecurity());
-                    earContext.setSecurityConfiguration(securityConfiguration);
-                }
                 DefaultPrincipal defaultPrincipal = earContext.getSecurityConfiguration().getDefaultPrincipal();
                 securityHolder.setDefaultPrincipal(defaultPrincipal);
                 if (defaultPrincipal != null) {



Mime
View raw message