geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r684568 [1/2] - in /geronimo/sandbox/djencks/jetty7: ./ geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/ geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/ geronimo-jetty7-clustering-bui...
Date Sun, 10 Aug 2008 18:42:40 GMT
Author: djencks
Date: Sun Aug 10 11:42:39 2008
New Revision: 684568

URL: http://svn.apache.org/viewvc?rev=684568&view=rev
Log:
Update rest of package names to jetty7.  Copy the auth modules from jetty branch and add a appended-resources NOTICE for them.  Update a bunch of stuff so jaspi sort of works.  This depends on uncommitted work in trunk so won't compile for a while

Added:
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty7/
      - copied from r674670, geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty6/
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/
      - copied from r674670, geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty6/
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/appended-resources/
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/appended-resources/META-INF/
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/appended-resources/META-INF/NOTICE.vm
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BaseAuthModule.java   (with props)
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BasicAuthModule.java   (with props)
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/ClientCertAuthModule.java   (with props)
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/DigestAuthModule.java   (with props)
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/FormAuthModule.java   (with props)
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/JAASLoginService.java   (with props)
Removed:
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty6/
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty6/
Modified:
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilderTest.java
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/wadi/builder/WADIJettyClusteringBuilder.java
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/AbstractClusteredPreHandler.java
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/ClusteredSessionHandler.java
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/ClusteredSessionHandlerFactory.java
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/ClusteredSessionManager.java
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/wadi/WADIClusteredPreHandler.java
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/wadi/WADIClusteredPreHandlerFactory.java
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/Host.java
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyWebAppContext.java
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/connector/JettyConnector.java
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/AuthConfigProviderHandlerFactory.java
    geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/AbstractWebModuleTest.java
    geronimo/sandbox/djencks/jetty7/jetty7-clustering-builder-wadi/src/main/plan/plan.xml
    geronimo/sandbox/djencks/jetty7/jetty7-deployer/src/main/plan/plan.xml
    geronimo/sandbox/djencks/jetty7/jetty7/src/main/plan/plan.xml
    geronimo/sandbox/djencks/jetty7/pom.xml

Modified: geronimo/sandbox/djencks/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java?rev=684568&r1=684567&r2=684568&view=diff
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java (original)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java Sun Aug 10 11:42:39 2008
@@ -82,6 +82,11 @@
 import org.apache.geronimo.jetty7.JettyWebAppContext;
 import org.apache.geronimo.jetty7.security.AuthConfigProviderHandlerFactory;
 import org.apache.geronimo.jetty7.security.ServerAuthConfigGBean;
+import org.apache.geronimo.jetty7.security.auth.BaseAuthModule;
+import org.apache.geronimo.jetty7.security.auth.BasicAuthModule;
+import org.apache.geronimo.jetty7.security.auth.DigestAuthModule;
+import org.apache.geronimo.jetty7.security.auth.FormAuthModule;
+import org.apache.geronimo.jetty7.security.auth.ClientCertAuthModule;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
@@ -128,10 +133,6 @@
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
-import org.mortbay.jetty.security.jaspi.modules.BasicAuthModule;
-import org.mortbay.jetty.security.jaspi.modules.ClientCertAuthModule;
-import org.mortbay.jetty.security.jaspi.modules.DigestAuthModule;
-import org.mortbay.jetty.security.jaspi.modules.FormAuthModule;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.SAXException;
@@ -781,6 +782,9 @@
             GBeanData securityFactoryData = new GBeanData(factoryName, AuthConfigProviderHandlerFactory.class);
             securityFactoryData.setAttribute("messageLayer", "Http");
             securityFactoryData.setAttribute("appContext", webModuleData.getAttribute("contextPath"));
+            if (jettyWebApp.isSetSecurityRealmName()) {
+                securityFactoryData.setAttribute("securityRealm", jettyWebApp.getSecurityRealmName());
+            }
             moduleContext.addGBean(securityFactoryData);
 
 
@@ -862,6 +866,7 @@
 
                     AuthModuleType<ServerAuthModule> authModuleType = new AuthModuleType<ServerAuthModule>();
                     String authMethod = loginConfig.getAuthMethod().getStringValue();
+                    Map<String, String> options = new HashMap<String, String>();
                     if ("BASIC".equals(authMethod)) {
                         authModuleType.setClassName(BasicAuthModule.class.getName());
                         //TODO set realm name?
@@ -876,10 +881,8 @@
 //                    webModuleData.setAttribute("authenticator", formAuthenticator);
                         if (loginConfig.isSetFormLoginConfig()) {
                             FormLoginConfigType formLoginConfig = loginConfig.getFormLoginConfig();
-                            Map<String, String> options = new HashMap<String, String>();
                             options.put(FormAuthModule.LOGIN_PAGE_KEY, formLoginConfig.getFormLoginPage().getStringValue());
                             options.put(FormAuthModule.ERROR_PAGE_KEY, formLoginConfig.getFormErrorPage().getStringValue());
-                            authModuleType.setOptions(options);
 //                        formAuthenticator.setLoginPage(formLoginConfig.getFormLoginPage().getStringValue());
 //                        formAuthenticator.setErrorPage(formLoginConfig.getFormErrorPage().getStringValue());
                         }
@@ -889,6 +892,12 @@
                     } else {
                         throw new DeploymentException("unrecognized auth method, use jaspi to configure: " + authMethod);
                     }
+                    if (jettyWebApp.isSetSecurityRealmName()) {
+                        options.put(BaseAuthModule.LOGIN_SERVICE_KEY, jettyWebApp.getSecurityRealmName().trim());
+                    }
+                    if (!options.isEmpty()) {
+                        authModuleType.setOptions(options);
+                    }
 
                     StringWriter out = new StringWriter();
                     try {

Modified: geronimo/sandbox/djencks/jetty7/geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilderTest.java?rev=684568&r1=684567&r2=684568&view=diff
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilderTest.java (original)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilderTest.java Sun Aug 10 11:42:39 2008
@@ -18,46 +18,34 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.util.ArrayList;
 import java.util.Collection;
 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.util.ArrayList;
-
-import org.apache.geronimo.testsupport.TestSupport;
 
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinatorGBean;
 import org.apache.geronimo.deployment.ModuleIDBuilder;
 import org.apache.geronimo.deployment.service.GBeanBuilder;
-import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.deployment.util.UnpackedJarFile;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
+import org.apache.geronimo.j2ee.deployment.ModuleBuilderExtension;
+import org.apache.geronimo.j2ee.deployment.NamingBuilderCollection;
 import org.apache.geronimo.j2ee.deployment.UnavailableWebServiceBuilder;
 import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
-import org.apache.geronimo.j2ee.deployment.NamingBuilderCollection;
-import org.apache.geronimo.j2ee.deployment.ModuleBuilderExtension;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
 import org.apache.geronimo.jetty7.JettyContainerImpl;
-import org.apache.geronimo.jetty7.deployment.JettyModuleBuilder;
 import org.apache.geronimo.jetty7.connector.HTTPSocketConnector;
 import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.Naming;
-import org.apache.geronimo.kernel.mock.MockConfigStore;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
@@ -65,11 +53,10 @@
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.EditableKernelConfigurationManager;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.geronimo.kernel.config.NoSuchConfigException;
-import org.apache.geronimo.kernel.config.NullConfigurationStore;
 import org.apache.geronimo.kernel.config.LifecycleException;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.kernel.mock.MockConfigStore;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactManager;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
@@ -78,19 +65,15 @@
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.ImportType;
 import org.apache.geronimo.kernel.repository.Repository;
-import org.apache.geronimo.security.deployment.GeronimoSecurityBuilderImpl;
-import org.apache.geronimo.security.SecurityService;
 import org.apache.geronimo.security.SecurityServiceImpl;
-import org.apache.geronimo.security.jacc.mappingprovider.GeronimoPolicyConfigurationFactory;
+import org.apache.geronimo.security.deployment.GeronimoSecurityBuilderImpl;
 import org.apache.geronimo.security.jacc.mappingprovider.GeronimoPolicy;
+import org.apache.geronimo.security.jacc.mappingprovider.GeronimoPolicyConfigurationFactory;
 import org.apache.geronimo.system.serverinfo.BasicServerInfo;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.apache.geronimo.testsupport.TestSupport;
 import org.apache.geronimo.transaction.manager.GeronimoTransactionManagerGBean;
 import org.apache.geronimo.xbeans.geronimo.j2ee.GerSecurityDocument;
-import org.apache.geronimo.schema.ElementConverter;
-import org.apache.geronimo.schema.SecurityElementConverter;
-import org.apache.geronimo.schema.NamespaceElementConverter;
-import org.apache.geronimo.schema.SchemaConversionUtils;
 import org.apache.xmlbeans.impl.schema.SchemaTypeImpl;
 
 /**
@@ -206,8 +189,6 @@
                 moduleName,
                 new AbstractNameQuery(tmName),
                 new AbstractNameQuery(ctcName),
-                null,
-                null,
                 null
         );
     }

Modified: geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/wadi/builder/WADIJettyClusteringBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/wadi/builder/WADIJettyClusteringBuilder.java?rev=684568&r1=674670&r2=684568&view=diff
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/wadi/builder/WADIJettyClusteringBuilder.java (original)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/wadi/builder/WADIJettyClusteringBuilder.java Sun Aug 10 11:42:39 2008
@@ -14,7 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.geronimo.jetty6.cluster.wadi.builder;
+package org.apache.geronimo.jetty7.cluster.wadi.builder;
 
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -36,9 +36,9 @@
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.jetty6.JettyWebAppContext;
-import org.apache.geronimo.jetty6.cluster.ClusteredSessionHandlerFactory;
-import org.apache.geronimo.jetty6.cluster.wadi.WADIClusteredPreHandlerFactory;
+import org.apache.geronimo.jetty7.JettyWebAppContext;
+import org.apache.geronimo.jetty7.cluster.ClusteredSessionHandlerFactory;
+import org.apache.geronimo.jetty7.cluster.wadi.WADIClusteredPreHandlerFactory;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.config.Configuration;

Modified: geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/AbstractClusteredPreHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/AbstractClusteredPreHandler.java?rev=684568&r1=674670&r2=684568&view=diff
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/AbstractClusteredPreHandler.java (original)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/AbstractClusteredPreHandler.java Sun Aug 10 11:42:39 2008
@@ -14,7 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.geronimo.jetty6.cluster;
+package org.apache.geronimo.jetty7.cluster;
 
 import java.io.IOException;
 
@@ -24,7 +24,7 @@
 
 import org.apache.geronimo.clustering.ClusteredInvocation;
 import org.apache.geronimo.clustering.ClusteredInvocationException;
-import org.apache.geronimo.jetty6.AbstractPreHandler;
+import org.apache.geronimo.jetty7.AbstractPreHandler;
 import org.mortbay.jetty.HttpException;
 
 /**

Modified: geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/ClusteredSessionHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/ClusteredSessionHandler.java?rev=684568&r1=674670&r2=684568&view=diff
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/ClusteredSessionHandler.java (original)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/ClusteredSessionHandler.java Sun Aug 10 11:42:39 2008
@@ -14,7 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.geronimo.jetty6.cluster;
+package org.apache.geronimo.jetty7.cluster;
 
 import java.io.IOException;
 
@@ -22,8 +22,8 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.geronimo.jetty6.AbstractPreHandler;
-import org.apache.geronimo.jetty6.PreHandler;
+import org.apache.geronimo.jetty7.AbstractPreHandler;
+import org.apache.geronimo.jetty7.PreHandler;
 import org.mortbay.jetty.servlet.SessionHandler;
 
 /**

Modified: geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/ClusteredSessionHandlerFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/ClusteredSessionHandlerFactory.java?rev=684568&r1=674670&r2=684568&view=diff
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/ClusteredSessionHandlerFactory.java (original)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/ClusteredSessionHandlerFactory.java Sun Aug 10 11:42:39 2008
@@ -14,12 +14,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.geronimo.jetty6.cluster;
+package org.apache.geronimo.jetty7.cluster;
 
 import org.apache.geronimo.clustering.SessionManager;
 import org.apache.geronimo.gbean.annotation.ParamReference;
-import org.apache.geronimo.jetty6.PreHandler;
-import org.apache.geronimo.jetty6.SessionHandlerFactory;
+import org.apache.geronimo.jetty7.PreHandler;
+import org.apache.geronimo.jetty7.SessionHandlerFactory;
 import org.mortbay.jetty.servlet.SessionHandler;
 
 /**

Modified: geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/ClusteredSessionManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/ClusteredSessionManager.java?rev=684568&r1=674670&r2=684568&view=diff
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/ClusteredSessionManager.java (original)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/ClusteredSessionManager.java Sun Aug 10 11:42:39 2008
@@ -14,7 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.geronimo.jetty6.cluster;
+package org.apache.geronimo.jetty7.cluster;
 
 import java.util.HashMap;
 import java.util.Map;

Modified: geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/wadi/WADIClusteredPreHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/wadi/WADIClusteredPreHandler.java?rev=684568&r1=674670&r2=684568&view=diff
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/wadi/WADIClusteredPreHandler.java (original)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/wadi/WADIClusteredPreHandler.java Sun Aug 10 11:42:39 2008
@@ -14,7 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.geronimo.jetty6.cluster.wadi;
+package org.apache.geronimo.jetty7.cluster.wadi;
 
 import java.io.IOException;
 
@@ -27,7 +27,7 @@
 
 import org.apache.geronimo.clustering.ClusteredInvocation;
 import org.apache.geronimo.clustering.ClusteredInvocationException;
-import org.apache.geronimo.jetty6.cluster.AbstractClusteredPreHandler;
+import org.apache.geronimo.jetty7.cluster.AbstractClusteredPreHandler;
 import org.codehaus.wadi.core.contextualiser.InvocationException;
 import org.codehaus.wadi.core.manager.Manager;
 import org.codehaus.wadi.web.impl.WebInvocation;

Modified: geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/wadi/WADIClusteredPreHandlerFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/wadi/WADIClusteredPreHandlerFactory.java?rev=684568&r1=674670&r2=684568&view=diff
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/wadi/WADIClusteredPreHandlerFactory.java (original)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/wadi/WADIClusteredPreHandlerFactory.java Sun Aug 10 11:42:39 2008
@@ -14,13 +14,13 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.geronimo.jetty6.cluster.wadi;
+package org.apache.geronimo.jetty7.cluster.wadi;
 
 import org.apache.geronimo.clustering.wadi.WADISessionManager;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.annotation.ParamReference;
-import org.apache.geronimo.jetty6.PreHandler;
-import org.apache.geronimo.jetty6.PreHandlerFactory;
+import org.apache.geronimo.jetty7.PreHandler;
+import org.apache.geronimo.jetty7.PreHandlerFactory;
 import org.codehaus.wadi.core.manager.Manager;
 
 

Added: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/appended-resources/META-INF/NOTICE.vm
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/appended-resources/META-INF/NOTICE.vm?rev=684568&view=auto
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/appended-resources/META-INF/NOTICE.vm (added)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/appended-resources/META-INF/NOTICE.vm Sun Aug 10 11:42:39 2008
@@ -0,0 +1,2 @@
+This product includes software developed at
+Mortbay Consulting (http://www.mortbay.org/).

Modified: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/Host.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/Host.java?rev=684568&r1=684567&r2=684568&view=diff
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/Host.java (original)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/Host.java Sun Aug 10 11:42:39 2008
@@ -20,7 +20,7 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 
 /**
- * Host gbean for jetty6 containing an array of hosts and virtual hosts
+ * Host gbean for jetty7 containing an array of hosts and virtual hosts
  */
 public class Host {
 

Modified: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java?rev=684568&r1=684567&r2=684568&view=diff
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java (original)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java Sun Aug 10 11:42:39 2008
@@ -78,7 +78,7 @@
 
         server = new JettyServer();
 
-        //set up the jetty6+ handler structure which is to have a HandlerCollection,
+        //set up the jetty7+ handler structure which is to have a HandlerCollection,
         //each element of which is always tried on each request.
         //The first element of the HandlerCollection is a
         //ContextHandlerCollection, which is itself is a collection

Modified: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyWebAppContext.java?rev=684568&r1=684567&r2=684568&view=diff
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyWebAppContext.java (original)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyWebAppContext.java Sun Aug 10 11:42:39 2008
@@ -114,7 +114,7 @@
 //    static {
 //        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic("Jetty WebApplication Context", JettyWebAppContext.class, NameFactory.WEB_MODULE);
 //        infoBuilder.addAttribute("deploymentDescriptor", String.class, true);
-//        //from jetty6's webapp context
+//        //from jetty7's webapp context
 //
 //        infoBuilder.addAttribute("displayName", String.class, true);
 //        infoBuilder.addAttribute("contextParamMap", Map.class, true);
@@ -212,44 +212,45 @@
 //
 //    }
 
-    public JettyWebAppContext(@ParamSpecial(type=SpecialAttributeType.objectName) String objectName,
-                              @ParamAttribute(name = "deploymentDescriptor") String originalSpecDD,
-                              @ParamAttribute(name = "componentContext") Map<String, Object> componentContext,
-                              @ParamSpecial(type=SpecialAttributeType.classLoader)  ClassLoader classLoader,
-                              @ParamAttribute(name = "configurationBaseUrl") URL configurationBaseUrl,
-                              @ParamAttribute(name = "unshareableResources") Set unshareableResources,
-                              @ParamAttribute(name = "applicationManagedSecurityResources") Set applicationManagedSecurityResources,
-                              @ParamAttribute(name = "displayName") String displayName,
-                              @ParamAttribute(name = "contextParamMap") Map contextParamMap,
-                              @ParamAttribute(name = "listenerClassNames") Collection<String> listenerClassNames,
-                              @ParamAttribute(name = "distributable") boolean distributable,
-                              @ParamAttribute(name = "mimeMap") Map mimeMap,
-                              @ParamAttribute(name = "welcomeFiles") String[] welcomeFiles,
-                              @ParamAttribute(name = "localeEncodingMapping") Map<String, String> localeEncodingMapping,
-                              @ParamAttribute(name = "errorPages") Map errorPages,
-                              @ParamAttribute(name = "tagLibMap") Map<String, String> tagLibMap,
-                              @ParamAttribute(name = "compactPath") boolean compactPath,
-
-                              @ParamAttribute(name = GBEAN_ATTR_SESSION_TIMEOUT) int sessionTimeoutSeconds,
-                              @ParamReference(name = GBEAN_REF_SESSION_HANDLER_FACTORY) SessionHandlerFactory handlerFactory,
-                              @ParamReference(name = GBEAN_REF_PRE_HANDLER_FACTORY) PreHandlerFactory preHandlerFactory,
-
-                              @ParamAttribute(name = "policyContextID") String policyContextID,
-                              @ParamAttribute(name = "securityRealmName") String securityRealmName,
-                              @ParamReference(name = "SecurityHandlerFactory")  SecurityHandlerFactory securityHandlerFactory,
-                              @ParamReference(name = "RunAsSource") RunAsSource runAsSource,
-
-                              @ParamAttribute(name = "holder") Holder holder,
-
-                              @ParamReference(name="Host") Host host,
-                              @ParamReference(name="TransactionManager") TransactionManager transactionManager,
-                              @ParamReference(name="TrackedConnectionAssociator") TrackedConnectionAssociator trackedConnectionAssociator,
-                              @ParamReference(name="JettyContainer") JettyContainer jettyContainer,
-                              @ParamReference(name="RuntimeCustomizer") RuntimeCustomizer contextCustomizer,
-
-                              @ParamReference(name="J2EEServer") J2EEServer server,
-                              @ParamReference(name="J2EEApplication") J2EEApplication application,
-                              @ParamSpecial(type=SpecialAttributeType.kernel) Kernel kernel) throws Exception {
+    public JettyWebAppContext(@ParamSpecial(type = SpecialAttributeType.objectName)String objectName,
+                              @ParamAttribute(name = "contextPath")String contextPath,
+                              @ParamAttribute(name = "deploymentDescriptor")String originalSpecDD,
+                              @ParamAttribute(name = "componentContext")Map<String, Object> componentContext,
+                              @ParamSpecial(type = SpecialAttributeType.classLoader)ClassLoader classLoader,
+                              @ParamAttribute(name = "configurationBaseUrl")URL configurationBaseUrl,
+                              @ParamAttribute(name = "unshareableResources")Set unshareableResources,
+                              @ParamAttribute(name = "applicationManagedSecurityResources")Set applicationManagedSecurityResources,
+                              @ParamAttribute(name = "displayName")String displayName,
+                              @ParamAttribute(name = "contextParamMap")Map contextParamMap,
+                              @ParamAttribute(name = "listenerClassNames")Collection<String> listenerClassNames,
+                              @ParamAttribute(name = "distributable")boolean distributable,
+                              @ParamAttribute(name = "mimeMap")Map mimeMap,
+                              @ParamAttribute(name = "welcomeFiles")String[] welcomeFiles,
+                              @ParamAttribute(name = "localeEncodingMapping")Map<String, String> localeEncodingMapping,
+                              @ParamAttribute(name = "errorPages")Map errorPages,
+                              @ParamAttribute(name = "tagLibMap")Map<String, String> tagLibMap,
+                              @ParamAttribute(name = "compactPath")boolean compactPath,
+
+                              @ParamAttribute(name = GBEAN_ATTR_SESSION_TIMEOUT)int sessionTimeoutSeconds,
+                              @ParamReference(name = GBEAN_REF_SESSION_HANDLER_FACTORY)SessionHandlerFactory handlerFactory,
+                              @ParamReference(name = GBEAN_REF_PRE_HANDLER_FACTORY)PreHandlerFactory preHandlerFactory,
+
+                              @ParamAttribute(name = "policyContextID")String policyContextID,
+                              @ParamAttribute(name = "securityRealmName")String securityRealmName,
+                              @ParamReference(name = "SecurityHandlerFactory")SecurityHandlerFactory securityHandlerFactory,
+                              @ParamReference(name = "RunAsSource")RunAsSource runAsSource,
+
+                              @ParamAttribute(name = "holder")Holder holder,
+
+                              @ParamReference(name = "Host")Host host,
+                              @ParamReference(name = "TransactionManager")TransactionManager transactionManager,
+                              @ParamReference(name = "TrackedConnectionAssociator")TrackedConnectionAssociator trackedConnectionAssociator,
+                              @ParamReference(name = "JettyContainer")JettyContainer jettyContainer,
+                              @ParamReference(name = "ContextCustomizer")RuntimeCustomizer contextCustomizer,
+
+                              @ParamReference(name = "J2EEServer")J2EEServer server,
+                              @ParamReference(name = "J2EEApplication")J2EEApplication application,
+                              @ParamSpecial(type = SpecialAttributeType.kernel)Kernel kernel) throws Exception {
 
         assert componentContext != null;
         assert classLoader != null;
@@ -288,6 +289,10 @@
         ServletHandler servletHandler = new ServletHandler();
 
         webAppContext = new TwistyWebAppContext(securityHandler, sessionHandler, servletHandler, null);
+        if (contextPath == null || !contextPath.startsWith("/")) {
+            throw new IllegalArgumentException("context contextPath must be non-null and start with '/', not " + contextPath);
+        }
+        webAppContext.setContextPath(contextPath);
         //See Jetty-386.  Setting this to true can expose secured content.
         webAppContext.setCompactPath(compactPath);
 
@@ -397,18 +402,11 @@
         return jettyContainer;
     }
 
-    public void setContextPath(String path) {
-        if (path == null || !path.startsWith("/")) {
-            throw new IllegalArgumentException("context path must be non-null and start with '/', not " + path);
-        }
-        this.webAppContext.setContextPath(path);
-    }
-
     public String getContextPath() {
         return this.webAppContext.getContextPath();
     }
 
-    public void setWorkDir(String workDir) {
+    public void setWorkDir(@ParamAttribute(name = "workDir") String workDir) {
         if(workDir == null) {
             return;
         }
@@ -494,7 +492,7 @@
     }
     //pass through attributes.  They should be constructor params
 
-    public void setLocaleEncodingMapping(Map<String, String> localeEncodingMap) {
+    public void setLocaleEncodingMapping(@ParamAttribute(name = "localeEncodingMapping")Map<String, String> localeEncodingMap) {
         if (localeEncodingMap != null) {
             for (Map.Entry<String, String> entry : localeEncodingMap.entrySet()) {
                 this.webAppContext.addLocaleEncoding(entry.getKey(), entry.getValue());
@@ -502,7 +500,7 @@
         }
     }
 
-    public void setListenerClassNames(Collection<String> eventListeners) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
+    public void setListenerClassNames(@ParamAttribute(name = "listenerClassNames")Collection<String> eventListeners) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
         if (eventListeners != null) {
             Collection<EventListener> listeners = new ArrayList<EventListener>();
             for (String listenerClassName : eventListeners) {
@@ -513,13 +511,13 @@
         }
     }
 
-    public void setErrorPages(Map errorPageMap) {
+    public void setErrorPages(@ParamAttribute(name = "errorPages")Map errorPageMap) {
         if (errorPageMap != null) {
             ((ErrorPageErrorHandler) this.webAppContext.getErrorHandler()).setErrorPages(errorPageMap);
         }
     }
 
-    public void setTagLibMap(Map<String, String> tagLibMap) {
+    public void setTagLibMap(@ParamAttribute(name = "tagLibMap")Map<String, String> tagLibMap) {
         if (tagLibMap != null) {
             for (Map.Entry<String, String> entry : tagLibMap.entrySet()) {
                 this.webAppContext.setResourceAlias(entry.getKey(), entry.getValue());
@@ -527,13 +525,13 @@
         }
     }
 
-    public void setSessionTimeoutSeconds(int seconds) {
+    public void setSessionTimeoutSeconds(@ParamAttribute(name = "sessionTimeoutSeconds")int seconds) {
         this.webAppContext.getSessionHandler().getSessionManager().setMaxInactiveInterval(seconds);
     }
 
 
     //TODO this is really dumb, but jetty5 liked to set the displayname to null frequently.
-    //we need to re-check for jetty6
+    //we need to re-check for jetty7
     public String getDisplayName() {
         return displayName;
     }

Modified: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/connector/JettyConnector.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/connector/JettyConnector.java?rev=684568&r1=684567&r2=684568&view=diff
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/connector/JettyConnector.java (original)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/connector/JettyConnector.java Sun Aug 10 11:42:39 2008
@@ -69,7 +69,7 @@
         stats = new JettyWebConnectorStatsImpl();
     }
 
-    //TODO: support the jetty6 specific methods
+    //TODO: support the jetty7 specific methods
     public String getHost() {
         return listener.getHost();
     }
@@ -165,7 +165,7 @@
     }
 
     public void setMaxThreads(int maxThreads) {
-        //TODO: in jetty6 connectors have a number of acceptor threads
+        //TODO: in jetty7 connectors have a number of acceptor threads
         listener.setAcceptors(maxThreads);
     }
 

Modified: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/AuthConfigProviderHandlerFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/AuthConfigProviderHandlerFactory.java?rev=684568&r1=684567&r2=684568&view=diff
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/AuthConfigProviderHandlerFactory.java (original)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/AuthConfigProviderHandlerFactory.java Sun Aug 10 11:42:39 2008
@@ -20,23 +20,22 @@
 
 package org.apache.geronimo.jetty7.security;
 
-import java.util.Map;
 import java.util.HashMap;
+import java.util.Map;
 
 import javax.security.auth.Subject;
-import javax.security.auth.message.config.ServerAuthConfig;
-import javax.security.auth.message.config.ServerAuthContext;
+import javax.security.auth.message.AuthException;
 import javax.security.auth.message.config.AuthConfigFactory;
 import javax.security.auth.message.config.AuthConfigProvider;
 import javax.security.auth.message.config.RegistrationListener;
-import javax.security.auth.message.AuthException;
+import javax.security.auth.message.config.ServerAuthConfig;
 
-import org.apache.geronimo.jetty7.handler.JettySecurityHandler;
-import org.apache.geronimo.security.jacc.RunAsSource;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.jetty7.handler.JettySecurityHandler;
+import org.apache.geronimo.jetty7.security.auth.BaseAuthModule;
+import org.apache.geronimo.security.jacc.RunAsSource;
 import org.mortbay.jetty.security.ServletCallbackHandler;
-import org.mortbay.jetty.security.jaspi.SimpleAuthConfig;
 
 /**
  * Fetches a ServerAuthConfig out of the AuthConfigFactory
@@ -53,8 +52,9 @@
     private final Subject serviceSubject = null;
 
 
-    public AuthConfigProviderHandlerFactory(@ParamAttribute(name = "messageLayer") String messageLayer,
-                                   @ParamAttribute(name = "appContext") String appContext) throws AuthException {
+    public AuthConfigProviderHandlerFactory(@ParamAttribute(name = "messageLayer")String messageLayer,
+                                            @ParamAttribute(name = "appContext")String appContext
+    ) throws AuthException {
         AuthConfigFactory authConfigFactory = AuthConfigFactory.getFactory();
         RegistrationListener listener = new RegistrationListener() {
 

Added: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BaseAuthModule.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BaseAuthModule.java?rev=684568&view=auto
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BaseAuthModule.java (added)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BaseAuthModule.java Sun Aug 10 11:42:39 2008
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.jetty7.security.auth;
+
+import java.util.Map;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.message.AuthException;
+import javax.security.auth.message.AuthStatus;
+import javax.security.auth.message.MessageInfo;
+import javax.security.auth.message.MessagePolicy;
+import javax.security.auth.message.config.ServerAuthContext;
+import javax.security.auth.message.module.ServerAuthModule;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.mortbay.jetty.security.JettyMessageInfo;
+import org.mortbay.jetty.security.jaspi.modules.LoginService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BaseAuthModule implements ServerAuthModule, ServerAuthContext
+{
+    private static final Class[] SUPPORTED_MESSAGE_TYPES = new Class[] {HttpServletRequest.class, HttpServletResponse.class};
+
+    public static final String LOGIN_SERVICE_KEY = "org.apache.geronimo.securityRealm";
+
+    protected CallbackHandler callbackHandler;
+    protected LoginService loginService;
+
+    public Class[] getSupportedMessageTypes()
+    {
+        return SUPPORTED_MESSAGE_TYPES;
+    }
+
+    public BaseAuthModule()
+    {
+    }
+
+    public BaseAuthModule(CallbackHandler callbackHandler, String securityRealm)
+    {
+        this.callbackHandler = callbackHandler;
+        this.loginService = new JAASLoginService(securityRealm);
+    }
+
+    public void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy, CallbackHandler handler, Map options) throws AuthException
+    {
+        this.callbackHandler = handler;
+        String securityRealm = (String) options.get(LOGIN_SERVICE_KEY);
+        this.loginService = new JAASLoginService(securityRealm);
+    }
+
+    public void cleanSubject(MessageInfo messageInfo, Subject subject) throws AuthException
+    {
+//        securityRealm.logout(subject);
+    }
+
+    public AuthStatus secureResponse(MessageInfo messageInfo, Subject serviceSubject) throws AuthException
+    {
+        //servlets do not need secured responses
+        return AuthStatus.SEND_SUCCESS;
+    }
+
+    public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException
+    {
+        return AuthStatus.FAILURE;
+    }
+
+    /**
+     * @param messageInfo message info to examine for mandatory flag
+     * @return whether authentication is mandatory or optional
+     */
+    protected boolean isMandatory(MessageInfo messageInfo)
+    {
+        String mandatory = (String) messageInfo.getMap().get(JettyMessageInfo.MANDATORY_KEY);
+        if (mandatory == null) return false;
+        return Boolean.valueOf(mandatory);
+    }
+}

Propchange: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BaseAuthModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BaseAuthModule.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BaseAuthModule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BasicAuthModule.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BasicAuthModule.java?rev=684568&view=auto
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BasicAuthModule.java (added)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BasicAuthModule.java Sun Aug 10 11:42:39 2008
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.jetty7.security.auth;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.message.AuthException;
+import javax.security.auth.message.AuthStatus;
+import javax.security.auth.message.MessageInfo;
+import javax.security.auth.message.MessagePolicy;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.mortbay.jetty.HttpHeaders;
+import org.mortbay.jetty.security.Constraint;
+import org.mortbay.jetty.security.JettyMessageInfo;
+import org.mortbay.jetty.security.jaspi.modules.LoginCredentials;
+import org.mortbay.jetty.security.jaspi.modules.LoginResult;
+import org.mortbay.jetty.security.jaspi.modules.UserPasswordLoginCredentials;
+import org.mortbay.log.Log;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BasicAuthModule extends BaseAuthModule
+{
+
+    private String realmName;
+    private static final String REALM_KEY = "org.mortbay.jetty.security.jaspi.modules.RealmName";
+
+    public BasicAuthModule()
+    {
+    }
+
+    public BasicAuthModule(CallbackHandler callbackHandler, String securityRealm, String realmName)
+    {
+        super(callbackHandler, securityRealm);
+        this.realmName = realmName;
+    }
+
+    @Override
+    public void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy, CallbackHandler handler, Map options) throws AuthException
+    {
+        super.initialize(requestPolicy, responsePolicy, handler, options);
+        realmName = (String) options.get(REALM_KEY);
+    }
+
+    @Override
+    public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException
+    {
+        HttpServletRequest request = (HttpServletRequest) messageInfo.getRequestMessage();
+        HttpServletResponse response = (HttpServletResponse) messageInfo.getResponseMessage();
+        String credentials = request.getHeader(HttpHeaders.AUTHORIZATION);
+
+        try
+        {
+            if (credentials != null)
+            {
+                if (Log.isDebugEnabled()) Log.debug("Credentials: " + credentials);
+                LoginCredentials loginCredentials = new UserPasswordLoginCredentials(credentials);
+                LoginResult loginResult = loginService.login(clientSubject, loginCredentials);
+                //TODO what should happen if !isMandatory but credentials exist and are wrong?
+                if (loginResult.isSuccess())
+                {
+                    callbackHandler.handle(new Callback[]{loginResult.getCallerPrincipalCallback(), loginResult.getGroupPrincipalCallback()});
+                    messageInfo.getMap().put(JettyMessageInfo.AUTH_METHOD_KEY, Constraint.__BASIC_AUTH);
+                    return AuthStatus.SUCCESS;
+                }
+
+            }
+
+            if (!isMandatory(messageInfo))
+            {
+                return AuthStatus.SUCCESS;
+            }
+            response.setHeader(HttpHeaders.WWW_AUTHENTICATE, "basic realm=\"" + realmName + '"');
+            response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+            return AuthStatus.SEND_CONTINUE;
+        }
+        catch (IOException e)
+        {
+            throw new AuthException(e.getMessage());
+        }
+        catch (UnsupportedCallbackException e)
+        {
+            throw new AuthException(e.getMessage());
+        }
+
+    }
+}

Propchange: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BasicAuthModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BasicAuthModule.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/BasicAuthModule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/ClientCertAuthModule.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/ClientCertAuthModule.java?rev=684568&view=auto
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/ClientCertAuthModule.java (added)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/ClientCertAuthModule.java Sun Aug 10 11:42:39 2008
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.jetty7.security.auth;
+
+import java.io.IOException;
+import java.security.Principal;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.message.AuthException;
+import javax.security.auth.message.AuthStatus;
+import javax.security.auth.message.MessageInfo;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.mortbay.jetty.security.B64Code;
+import org.mortbay.jetty.security.Constraint;
+import org.mortbay.jetty.security.JettyMessageInfo;
+import org.mortbay.jetty.security.jaspi.modules.LoginCredentials;
+import org.mortbay.jetty.security.jaspi.modules.UserPasswordLoginCredentials;
+import org.mortbay.jetty.security.jaspi.modules.LoginResult;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ClientCertAuthModule extends BaseAuthModule
+{
+
+
+    public ClientCertAuthModule()
+    {
+    }
+
+    public ClientCertAuthModule(CallbackHandler callbackHandler, String securityRealm)
+    {
+        super(callbackHandler, securityRealm);
+    }
+
+    @Override
+    public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException
+    {
+        HttpServletRequest request = (HttpServletRequest) messageInfo.getRequestMessage();
+        HttpServletResponse response = (HttpServletResponse) messageInfo.getResponseMessage();
+        java.security.cert.X509Certificate[] certs =
+            (java.security.cert.X509Certificate[])
+            request.getAttribute("javax.servlet.request.X509Certificate");
+
+        try
+        {
+        // Need certificates.
+        if (certs==null || certs.length==0 || certs[0]==null)
+        {
+            response.sendError(HttpServletResponse.SC_FORBIDDEN,"A client certificate is required for accessing this web application but the server's listener is not configured for mutual authentication (or the client did not provide a certificate).");
+            return AuthStatus.SEND_FAILURE;
+        }
+            Principal principal = certs[0].getSubjectDN();
+            if (principal==null)
+                principal=certs[0].getIssuerDN();
+            final String username=principal==null?"clientcert":principal.getName();
+            //TODO no idea if this is correct
+            final char[] password = B64Code.encode(certs[0].getSignature());
+
+            LoginCredentials loginCredentials = new UserPasswordLoginCredentials(username, password);
+            LoginResult loginResult = loginService.login(clientSubject, loginCredentials);
+            if (loginResult.isSuccess())
+            {
+                callbackHandler.handle(new Callback[] {loginResult.getCallerPrincipalCallback(), loginResult.getGroupPrincipalCallback()});
+                messageInfo.getMap().put(JettyMessageInfo.AUTH_METHOD_KEY, Constraint.__CERT_AUTH);
+                return AuthStatus.SUCCESS;
+            }
+
+            if (!isMandatory(messageInfo))
+            {
+                return AuthStatus.SUCCESS;
+            }
+            response.sendError(HttpServletResponse.SC_FORBIDDEN,"The provided client certificate does not correspond to a trusted user.");
+            return AuthStatus.SEND_FAILURE;
+        }
+        catch (IOException e)
+        {
+            throw new AuthException(e.getMessage());
+        }
+        catch (UnsupportedCallbackException e)
+        {
+            throw new AuthException(e.getMessage());
+        }
+
+    }
+}
\ No newline at end of file

Propchange: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/ClientCertAuthModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/ClientCertAuthModule.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/ClientCertAuthModule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/DigestAuthModule.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/DigestAuthModule.java?rev=684568&view=auto
==============================================================================
--- geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/DigestAuthModule.java (added)
+++ geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/DigestAuthModule.java Sun Aug 10 11:42:39 2008
@@ -0,0 +1,374 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.jetty7.security.auth;
+
+import java.io.IOException;
+import java.security.MessageDigest;
+import java.util.Map;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.message.AuthException;
+import javax.security.auth.message.AuthStatus;
+import javax.security.auth.message.MessageInfo;
+import javax.security.auth.message.MessagePolicy;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.mortbay.jetty.HttpHeaders;
+import org.mortbay.jetty.security.B64Code;
+import org.mortbay.jetty.security.Constraint;
+import org.mortbay.jetty.security.Credential;
+import org.mortbay.jetty.security.JettyMessageInfo;
+import org.mortbay.jetty.security.jaspi.modules.LoginCredentials;
+import org.mortbay.jetty.security.jaspi.modules.UserPasswordLoginCredentials;
+import org.mortbay.jetty.security.jaspi.modules.LoginResult;
+import org.mortbay.log.Log;
+import org.mortbay.util.QuotedStringTokenizer;
+import org.mortbay.util.StringUtil;
+import org.mortbay.util.TypeUtil;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DigestAuthModule extends BaseAuthModule
+{
+
+    protected long maxNonceAge=0;
+    protected long nonceSecret=this.hashCode() ^ System.currentTimeMillis();
+    protected boolean useStale=false;
+
+    private String realmName;
+    private static final String REALM_KEY = "org.mortbay.jetty.security.jaspi.modules.RealmName";
+
+    public DigestAuthModule()
+    {
+    }
+
+    public DigestAuthModule(CallbackHandler callbackHandler, String securityRealm, String realmName)
+    {
+        super(callbackHandler, securityRealm);
+        this.realmName = realmName;
+    }
+
+    @Override
+    public void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy, CallbackHandler handler, Map options) throws AuthException
+    {
+        super.initialize(requestPolicy, responsePolicy, handler, options);
+        realmName = (String) options.get(REALM_KEY);
+    }
+
+    @Override
+    public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException
+    {
+        HttpServletRequest request = (HttpServletRequest) messageInfo.getRequestMessage();
+        HttpServletResponse response = (HttpServletResponse) messageInfo.getResponseMessage();
+        String credentials = request.getHeader(HttpHeaders.AUTHORIZATION);
+
+        try
+        {
+            boolean stale = false;
+            //TODO extract from request
+            long timestamp = System.currentTimeMillis();
+            if (credentials!=null )
+            {
+                    if(Log.isDebugEnabled())Log.debug("Credentials: "+credentials);
+                if(Log.isDebugEnabled())Log.debug("Credentials: "+credentials);
+                QuotedStringTokenizer tokenizer = new QuotedStringTokenizer(credentials,
+                                                                            "=, ",
+                                                                            true,
+                                                                            false);
+                final Digest digest=new Digest(request.getMethod());
+                String last=null;
+                String name=null;
+
+                while (tokenizer.hasMoreTokens())
+                {
+                    String tok = tokenizer.nextToken();
+                    char c=(tok.length()==1)?tok.charAt(0):'\0';
+
+                    switch (c)
+                    {
+                      case '=':
+                          name=last;
+                          last=tok;
+                          break;
+                      case ',':
+                          name=null;
+                      case ' ':
+                          break;
+
+                      default:
+                          last=tok;
+                          if (name!=null)
+                          {
+                              if ("username".equalsIgnoreCase(name))
+                                  digest.username=tok;
+                              else if ("realm".equalsIgnoreCase(name))
+                                  digest.realm=tok;
+                              else if ("nonce".equalsIgnoreCase(name))
+                                  digest.nonce=tok;
+                              else if ("nc".equalsIgnoreCase(name))
+                                  digest.nc=tok;
+                              else if ("cnonce".equalsIgnoreCase(name))
+                                  digest.cnonce=tok;
+                              else if ("qop".equalsIgnoreCase(name))
+                                  digest.qop=tok;
+                              else if ("uri".equalsIgnoreCase(name))
+                                  digest.uri=tok;
+                              else if ("response".equalsIgnoreCase(name))
+                                  digest.response=tok;
+                              break;
+                          }
+                    }
+                }
+
+                int n=checkNonce(digest.nonce,timestamp);
+
+                if (n > 0)
+                {
+                    LoginCredentials loginCredentials = new UserPasswordLoginCredentials(digest.username,digest.toString().toCharArray());
+                    LoginResult loginResult = loginService.login(clientSubject, loginCredentials);
+                    //TODO what should happen if !isMandatory but credentials exist and are wrong?
+                    if (loginResult.isSuccess())
+                    {
+                        callbackHandler.handle(new Callback[] {loginResult.getCallerPrincipalCallback(), loginResult.getGroupPrincipalCallback()});
+                        messageInfo.getMap().put(JettyMessageInfo.AUTH_METHOD_KEY, Constraint.__DIGEST_AUTH);
+                        return AuthStatus.SUCCESS;
+                    }
+                }
+                else if (n == 0)
+                    stale = true;
+
+            }
+
+            if (!isMandatory(messageInfo))
+            {
+                return AuthStatus.SUCCESS;
+            }
+            String domain=request.getContextPath();
+            if (domain==null)
+                domain="/";
+            response.setHeader(HttpHeaders.WWW_AUTHENTICATE, "Digest realm=\""+realmName+
+			    "\", domain=\""+domain +
+			    "\", nonce=\""+newNonce(timestamp)+
+			    "\", algorithm=MD5, qop=\"auth\"" + (useStale?(" stale="+stale):""));
+            response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+            return AuthStatus.SEND_CONTINUE;
+        }
+        catch (IOException e)
+        {
+            throw new AuthException(e.getMessage());
+        }
+        catch (UnsupportedCallbackException e)
+        {
+            throw new AuthException(e.getMessage());
+        }
+
+    }
+    public String newNonce(long ts)
+    {
+//        long ts=request.getTimeStamp();
+        long sk=nonceSecret;
+
+        byte[] nounce = new byte[24];
+        for (int i=0;i<8;i++)
+        {
+            nounce[i]=(byte)(ts&0xff);
+            ts=ts>>8;
+            nounce[8+i]=(byte)(sk&0xff);
+            sk=sk>>8;
+        }
+
+        byte[] hash=null;
+        try
+        {
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            md.reset();
+            md.update(nounce,0,16);
+            hash = md.digest();
+        }
+        catch(Exception e)
+        {
+            Log.warn(e);
+        }
+
+        for (int i=0;i<hash.length;i++)
+        {
+            nounce[8+i]=hash[i];
+            if (i==23)
+                break;
+        }
+
+        return new String(B64Code.encode(nounce));
+    }
+
+    /**
+     * @param nonce
+     * @param timestamp should be timestamp of request.
+     * @return -1 for a bad nonce, 0 for a stale none, 1 for a good nonce
+     */
+    /* ------------------------------------------------------------ */
+    public int checkNonce(String nonce, long timestamp)
+    {
+        try
+        {
+            byte[] n = B64Code.decode(nonce.toCharArray());
+            if (n.length!=24)
+                return -1;
+
+            long ts=0;
+            long sk=nonceSecret;
+            byte[] n2 = new byte[16];
+            System.arraycopy(n, 0, n2, 0, 8);
+            for (int i=0;i<8;i++)
+            {
+                n2[8+i]=(byte)(sk&0xff);
+                sk=sk>>8;
+                ts=(ts<<8)+(0xff&(long)n[7-i]);
+            }
+
+            long age=timestamp-ts;
+            if (Log.isDebugEnabled()) Log.debug("age="+age);
+
+            byte[] hash=null;
+            try
+            {
+                MessageDigest md = MessageDigest.getInstance("MD5");
+                md.reset();
+                md.update(n2,0,16);
+                hash = md.digest();
+            }
+            catch(Exception e)
+            {
+                Log.warn(e);
+            }
+
+            for (int i=0;i<16;i++)
+                if (n[i+8]!=hash[i])
+                    return -1;
+
+            if(maxNonceAge>0 && (age<0 || age>maxNonceAge))
+                return 0; // stale
+
+            return 1;
+        }
+        catch(Exception e)
+        {
+            Log.ignore(e);
+        }
+        return -1;
+    }
+
+    private static class Digest extends Credential
+    {
+        String method=null;
+        String username = null;
+        String realm = null;
+        String nonce = null;
+        String nc = null;
+        String cnonce = null;
+        String qop = null;
+        String uri = null;
+        String response=null;
+
+        /* ------------------------------------------------------------ */
+        Digest(String m)
+        {
+            method=m;
+        }
+
+        /* ------------------------------------------------------------ */
+        public boolean check(Object credentials)
+        {
+            String password=(credentials instanceof String)
+                ?(String)credentials
+                :credentials.toString();
+
+            try{
+                MessageDigest md = MessageDigest.getInstance("MD5");
+                byte[] ha1;
+                if(credentials instanceof Credential.MD5)
+                {
+                    // Credentials are already a MD5 digest - assume it's in
+                    // form user:realm:password (we have no way to know since
+                    // it's a digest, alright?)
+                    ha1 = ((Credential.MD5)credentials).getDigest();
+                }
+                else
+                {
+                    // calc A1 digest
+                    md.update(username.getBytes(StringUtil.__ISO_8859_1));
+                    md.update((byte)':');
+                    md.update(realm.getBytes(StringUtil.__ISO_8859_1));
+                    md.update((byte)':');
+                    md.update(password.getBytes(StringUtil.__ISO_8859_1));
+                    ha1=md.digest();
+                }
+                // calc A2 digest
+                md.reset();
+                md.update(method.getBytes(StringUtil.__ISO_8859_1));
+                md.update((byte)':');
+                md.update(uri.getBytes(StringUtil.__ISO_8859_1));
+                byte[] ha2=md.digest();
+
+
+
+
+
+                // calc digest
+                // request-digest  = <"> < KD ( H(A1), unq(nonce-value) ":" nc-value ":" unq(cnonce-value) ":" unq(qop-value) ":" H(A2) ) <">
+                // request-digest  = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <">
+
+
+
+                md.update(TypeUtil.toString(ha1,16).getBytes(StringUtil.__ISO_8859_1));
+                md.update((byte)':');
+                md.update(nonce.getBytes(StringUtil.__ISO_8859_1));
+                md.update((byte)':');
+                md.update(nc.getBytes(StringUtil.__ISO_8859_1));
+                md.update((byte)':');
+                md.update(cnonce.getBytes(StringUtil.__ISO_8859_1));
+                md.update((byte)':');
+                md.update(qop.getBytes(StringUtil.__ISO_8859_1));
+                md.update((byte)':');
+                md.update(TypeUtil.toString(ha2,16).getBytes(StringUtil.__ISO_8859_1));
+                byte[] digest=md.digest();
+
+                // check digest
+                return (TypeUtil.toString(digest,16).equalsIgnoreCase(response));
+            }
+            catch (Exception e)
+            {Log.warn(e);}
+
+            return false;
+        }
+
+        public String toString()
+        {
+            return username+","+response;
+        }
+
+    }
+
+}
\ No newline at end of file

Propchange: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/DigestAuthModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/DigestAuthModule.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/djencks/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/auth/DigestAuthModule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message