You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ni...@apache.org on 2004/07/27 19:26:53 UTC

svn commit: rev 30790 - in avalon/trunk/planet/facilities/http: impl/src/main/org/apache/avalon/http/impl spi/src/main/org/apache/avalon/http

Author: niclas
Date: Tue Jul 27 10:26:53 2004
New Revision: 30790

Added:
   avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/BasicAuthenticator.java   (contents, props changed)
Modified:
   avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HttpContextImpl.java
   avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpContextService.java
Log:
Adding the BasicAuthenticator wrapper first. Can't really test anything until the UserRealm is in place.

Added: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/BasicAuthenticator.java
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/BasicAuthenticator.java	Tue Jul 27 10:26:53 2004
@@ -0,0 +1,72 @@
+/* 
+ * Copyright 2004 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.avalon.http.impl;
+
+import org.apache.avalon.framework.logger.LogEnabled;
+import org.apache.avalon.framework.logger.Logger;
+
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+
+import org.apache.avalon.http.HttpContextService;
+
+import org.mortbay.http.Authenticator;
+
+/** Wrapper for the Jetty SocketListener.
+ *
+ * @avalon.component name="http-socket-listener" lifestyle="singleton"
+ * @avalon.service type="org.mortbay.http.HttpListener"
+ */
+public class BasicAuthenticator extends org.mortbay.http.BasicAuthenticator
+    implements Serviceable, LogEnabled
+{
+    private HttpContextService  m_Context;
+    private Logger              m_Logger;
+    
+    public BasicAuthenticator()
+    {
+    }
+    
+    /**
+     * Enable the logging system.
+     *
+     * @avalon.logger name="http"
+     */
+    public void enableLogging( Logger logger )
+    {
+        m_Logger = logger;
+    }
+    
+    public Logger getLogger()
+    {
+        return m_Logger;
+    }
+    
+    /**  
+     * @avalon.dependency type="org.apache.avalon.http.HttpContextService"
+     *                    key="httpcontext" 
+     */
+    public void service( ServiceManager man )
+        throws ServiceException
+    {
+        m_Context = (HttpContextService) man.lookup( "httpcontext" );
+        m_Context.setAuthenticator( this );
+    }
+} 
+ 

Modified: avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HttpContextImpl.java
==============================================================================
--- avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HttpContextImpl.java	(original)
+++ avalon/trunk/planet/facilities/http/impl/src/main/org/apache/avalon/http/impl/HttpContextImpl.java	Tue Jul 27 10:26:53 2004
@@ -83,6 +83,17 @@
         return m_HttpContext;
     }
     
+    public void setAuthenticator( Authenticator authenticator )
+    {
+        m_HttpContext.setAuthenticator( authenticator );
+    }
+    
+    public Authenticator getAuthenticator()
+    {
+        return m_HttpContext.getAuthenticator();
+    }
+    
+    
     /**
      * Enable the logging system.
      *

Modified: avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpContextService.java
==============================================================================
--- avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpContextService.java	(original)
+++ avalon/trunk/planet/facilities/http/spi/src/main/org/apache/avalon/http/HttpContextService.java	Tue Jul 27 10:26:53 2004
@@ -17,6 +17,7 @@
 
 package org.apache.avalon.http;
 
+import org.mortbay.http.Authenticator;
 import org.mortbay.http.HttpContext;
 import org.mortbay.http.HttpHandler;
 
@@ -33,4 +34,6 @@
     void removeHandler( HttpHandler handler );
     
     HttpContext getHttpContext();
+    
+    void setAuthenticator( Authenticator authenticator );
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org