Horde_Auth_Application improvements.
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 15 Oct 2009 11:37:58 +0000 (05:37 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 15 Oct 2009 11:58:15 +0000 (05:58 -0600)
Add getCredential().
Pass auth instance to application's transparent handler.

framework/Auth/lib/Horde/Auth/Application.php

index 00e56e2..47798e9 100644 (file)
@@ -234,7 +234,8 @@ class Horde_Auth_Application extends Horde_Auth_Base
     }
 
     /**
-     * Attempt transparent authentication.
+     * Attempt transparent authentication. The application method is passed a
+     * single parameter: the current class instance.
      *
      * @return boolean  Whether transparent login is supported.
      * @throws Horde_Auth_Exception
@@ -250,7 +251,7 @@ class Horde_Auth_Application extends Horde_Auth_Base
         }
 
         $registry = Horde_Registry::singleton();
-        return $registry->callAppMethod($this->_app, $this->_apiMethods['transparent'], array('noperms' => true));
+        return $registry->callAppMethod($this->_app, $this->_apiMethods['transparent'], array('args' => array($this), 'noperms' => true));
     }
 
     /**
@@ -293,6 +294,28 @@ class Horde_Auth_Application extends Horde_Auth_Base
     }
 
     /**
+     * Provide method to get internal credential values. Necessary as the
+     * application API does not have direct access to the protected member
+     * variables of this class.
+     *
+     * @param mixed $name  The credential name to get. If null, will return
+     *                     the entire credential list.
+     *
+     * @return mixed  Return the credential information, or null if the.
+     *                credential doesn't exist.
+     */
+    public function getCredential($name = null)
+    {
+        if (is_null($name)) {
+            return $this->_credentials;
+        }
+
+        return isset($this->_credentials[$name])
+            ? $this->_credentials[$name]
+            : null;
+    }
+
+    /**
      * Provide method to set internal credential values. Necessary as the
      * application API does not have direct access to the protected member
      * variables of this class.