HttpRemote -> Http_Remote and tweak class loading so that this allworks
authorChuck Hagenbuch <chuck@horde.org>
Tue, 14 Jul 2009 04:45:10 +0000 (00:45 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Tue, 14 Jul 2009 04:45:10 +0000 (00:45 -0400)
framework/Auth/lib/Horde/Auth.php
framework/Auth/lib/Horde/Auth/Http/Remote.php [new file with mode: 0644]
framework/Auth/lib/Horde/Auth/HttpRemote.php [deleted file]
framework/Auth/package.xml

index 285eb87..290f2bc 100644 (file)
@@ -81,12 +81,12 @@ class Horde_Auth
      */
     static public function factory($driver, $params = null)
     {
-        $driver = basename($driver);
+        $driver = str_replace(' ', '_' , ucwords(str_replace('_', ' ', basename($driver))));
         if (empty($params)) {
             $params = Horde::getDriverConfig('auth', $driver);
         }
 
-        $class = 'Horde_Auth_' . ucfirst($driver);
+        $class = 'Horde_Auth_' . $driver;
         if (class_exists($class)) {
             return new $class($params);
         }
diff --git a/framework/Auth/lib/Horde/Auth/Http/Remote.php b/framework/Auth/lib/Horde/Auth/Http/Remote.php
new file mode 100644 (file)
index 0000000..6391fb5
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * The Horde_Auth_Http_Remote class authenticates users against a remote
+ * HTTP-Auth endpoint.
+ *
+ * Copyright 2007-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you did
+ * not receive this file, see http://opensource.org/licenses/lgpl-2.1.php
+ *
+ * @author  Duck <duck@obala.net>
+ * @package Horde_Auth
+ */
+class Horde_Auth_Http_Remote extends Horde_Auth_Base
+{
+    /**
+     * Find out if a set of login credentials are valid.
+     *
+     * @param string $userId       The userId to check.
+     * @param array  $credentials  An array of login credentials.
+     *
+     * @throws Horde_Exception
+     */
+    protected function _authenticate($userId, $credentials)
+    {
+        $options = array(
+            'allowRedirects' => true,
+            'method' => 'GET',
+            'timeout' => 5
+        );
+
+        if (!empty($GLOBALS['conf']['http']['proxy']['proxy_host'])) {
+            $options = array_merge($options, $GLOBALS['conf']['http']['proxy']);
+        }
+
+        $request = new HTTP_Request($this->_params['url'], $options);
+        $request->setBasicAuth($userId, $credentials['password']);
+
+        $request->sendRequest();
+
+        if ($request->getResponseCode() != 200) {
+            throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+        }
+    }
+
+}
diff --git a/framework/Auth/lib/Horde/Auth/HttpRemote.php b/framework/Auth/lib/Horde/Auth/HttpRemote.php
deleted file mode 100644 (file)
index 79bd206..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/**
- * The Auth_Http_Remote class authenticates users against a remote
- * HTTP-Auth endpoint.
- *
- * Copyright 2007-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you did
- * not receive this file, see http://opensource.org/licenses/lgpl-2.1.php
- *
- * @author  Duck <duck@obala.net>
- * @package Horde_Auth
- */
-class Horde_Auth_HttpRemote extends Horde_Auth_Base
-{
-    /**
-     * Find out if a set of login credentials are valid.
-     *
-     * @param string $userId       The userId to check.
-     * @param array  $credentials  An array of login credentials.
-     *
-     * @throws Horde_Exception
-     */
-    protected function _authenticate($userId, $credentials)
-    {
-        $options = array(
-            'allowRedirects' => true,
-            'method' => 'GET',
-            'timeout' => 5
-        );
-
-        if (!empty($GLOBALS['conf']['http']['proxy']['proxy_host'])) {
-            $options = array_merge($options, $GLOBALS['conf']['http']['proxy']);
-        }
-
-        $request = new HTTP_Request($this->_params['url'], $options);
-        $request->setBasicAuth($userId, $credentials['password']);
-
-        $request->sendRequest();
-
-        if ($request->getResponseCode() != 200) {
-            throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
-        }
-    }
-
-}
index 78e56b6..67ae1eb 100644 (file)
@@ -38,6 +38,9 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <dir name="lib">
     <dir name="Horde">
      <dir name="Auth">
+      <dir name="Http">
+       <file name="Remote.php" role="php" />
+      </dir> <!-- /lib/Horde/Auth/Http -->
       <dir name="Signup">
        <file name="Sql.php" role="php" />
       </dir> <!-- /lib/Horde/Auth/Signup -->
@@ -50,7 +53,6 @@ http://pear.php.net/dtd/package-2.0.xsd">
       <file name="Cyrus.php" role="php" />
       <file name="Ftp.php" role="php" />
       <file name="Http.php" role="php" />
-      <file name="HttpRemote.php" role="php" />
       <file name="Imap.php" role="php" />
       <file name="Imsp.php" role="php" />
       <file name="Ipbasic.php" role="php" />
@@ -140,7 +142,6 @@ http://pear.php.net/dtd/package-2.0.xsd">
  </dependencies>
  <phprelease>
   <filelist>
-   <install name="lib/Horde/Auth/Signup/Sql.php" as="Horde/Auth/Signup/Sql.php" />
    <install name="lib/Horde/Auth/Application.php" as="Horde/Auth/Application.php" />
    <install name="lib/Horde/Auth/Auto.php" as="Horde/Auth/Auto.php" />
    <install name="lib/Horde/Auth/Base.php" as="Horde/Auth/Base.php" />
@@ -149,8 +150,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <install name="lib/Horde/Auth/Cyrsql.php" as="Horde/Auth/Cyrsql.php" />
    <install name="lib/Horde/Auth/Cyrus.php" as="Horde/Auth/Cyrus.php" />
    <install name="lib/Horde/Auth/Ftp.php" as="Horde/Auth/Ftp.php" />
+   <install name="lib/Horde/Auth/Http/Remote.php" as="Horde/Auth/Http/Remote.php" />
    <install name="lib/Horde/Auth/Http.php" as="Horde/Auth/Http.php" />
-   <install name="lib/Horde/Auth/HttpRemote.php" as="Horde/Auth/HttpRemote.php" />
    <install name="lib/Horde/Auth/Imap.php" as="Horde/Auth/Imap.php" />
    <install name="lib/Horde/Auth/Imsp.php" as="Horde/Auth/Imsp.php" />
    <install name="lib/Horde/Auth/Ipbasic.php" as="Horde/Auth/Ipbasic.php" />
@@ -164,6 +165,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <install name="lib/Horde/Auth/Peclsasl.php" as="Horde/Auth/Peclsasl.php" />
    <install name="lib/Horde/Auth/Radius.php" as="Horde/Auth/Radius.php" />
    <install name="lib/Horde/Auth/Shibboleth.php" as="Horde/Auth/Shibboleth.php" />
+   <install name="lib/Horde/Auth/Signup/Sql.php" as="Horde/Auth/Signup/Sql.php" />
    <install name="lib/Horde/Auth/Signup.php" as="Horde/Auth/Signup.php" />
    <install name="lib/Horde/Auth/Smb.php" as="Horde/Auth/Smb.php" />
    <install name="lib/Horde/Auth/Smbclient.php" as="Horde/Auth/Smbclient.php" />