The _imp_authenticate api method is required for authenticating via
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 1 Feb 2009 17:27:44 +0000 (12:27 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 1 Feb 2009 17:27:44 +0000 (12:27 -0500)
any of Horde's rpc servers.  Looks like it got dropped somewhere
between the last commit in CVS and the import into git.

Michael, I'm assuming this was not intended?

imp/lib/api.php

index b5650e3..319cb35 100644 (file)
@@ -20,6 +20,12 @@ $_services['authCredentials'] = array(
     'type' => '{urn:horde}hashHash'
 );
 
+$_services['authenticate'] = array(
+    'args' => array('userID' => 'string', 'credentials' => '{urn:horde}hash', 'params' => '{urn:horde}hash'),
+    'checkperms' => false,
+    'type' => 'boolean'
+);
+
 $_services['compose'] = array(
     'args' => array('args' => '{urn:horde}hash', 'extra' => '{urn:horde}hash'),
     'type' => 'string'
@@ -138,6 +144,31 @@ function _imp_authCredentials()
 }
 
 /**
+ * Tries to authenticate with the mail server and create a mail session.
+ *
+ * @param string $userID The username of the user.
+ * @param array $credentials Credentials of the user. Only allowed key:
+ * 'password'.
+ * @param array $params Additional parameters. Only allowed key:
+ * 'server'.
+ *
+ * @return boolean True on success, false on failure.
+ */
+function _imp_authenticate($userID, $credentials, $params = array())
+{
+    $GLOBALS['authentication'] = 'none';
+    $GLOBALS['noset_view'] = true;
+    require_once dirname(__FILE__) . '/base.php';
+    require_once IMP_BASE . '/lib/Session.php';
+
+    $server_key = empty($params['server'])
+    ? IMP_Session::getAutoLoginServer()
+    : $params['server'];
+
+     return IMP_Session::createSession($userID, $credentials['password'], $server_key);
+}
+
+/**
  * Returns a compose window link.
  *
  * @param string|array $args  List of arguments to pass to compose.php.