* parameters a subclass might need.
*
* @return Horde_Auth_Base The newly created concrete instance.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
static public function factory($driver, $params = null)
{
return new $class($params);
}
- throw new Horde_Exception('Class definition of ' . $class . ' not found.');
+ throw new Horde_Auth_Exception('Class definition of ' . $class . ' not found.');
}
/**
* connection parameters a subclass might need.
*
* @return Horde_Auth_Base The concrete reference.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
static public function singleton($driver, $params = array())
{
*
* @param string $userId The userId to delete.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
static public function removeUserData($userId)
{
foreach ($GLOBALS['registry']->listApps(array('notoolbar', 'hidden', 'active', 'admin')) as $app) {
try {
$GLOBALS['registry']->callByPackage($app, 'removeUserData', array($userId));
- } catch (Horde_Exception $e) {
+ } catch (Horde_Auth_Exception $e) {
Horde::logMessage($e, __FILE__, __LINE__, PEAR_LOG_ERR);
$errApps[] = $app;
}
}
if (count($errApps)) {
- throw new Horde_Exception(sprintf(_("The following applications encountered errors removing user data: %s"), implode(', ', $errApps)));
+ throw new Horde_Auth_Exception(sprintf(_("The following applications encountered errors removing user data: %s"), implode(', ', $errApps)));
}
}
* @param string $userId The userId to check.
* @param array $credentials The credentials to use.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
if (!$this->hasCapability('authenticate')) {
- throw new Horde_Exception($this->_params['app'] . ' does not provide an authenticate() method.');
+ throw new Horde_Auth_Exception($this->_params['app'] . ' does not provide an authenticate() method.');
}
$registry = Horde_Registry::singleton();
try {
$result = $registry->callByPackage($this->_params['app'], 'authenticate', array($userId, $credentials, $this->_params['params']));
- } catch (Horde_Exception $e) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ } catch (Horde_Auth_Exception $e) {
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
// Horrific hack. Avert your eyes. Since an application may already
* List all users in the system.
*
* @return array The array of userIds.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function listUsers()
{
* @param string $userId The userId to add.
* @param array $credentials The credentials to use.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function addUser($userId, $credentials)
{
* @param string $newID The new userId.
* @param array $credentials The new credentials
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function updateUser($oldID, $newID, $credentials)
{
*
* @param string $userId The userId to delete.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function removeUser($userId)
{
}
/**
- * Horde_Exception should pass a message string (if any) in the message
+ * Horde_Auth_Exception should pass a message string (if any) in the message
* field, and the REASON_* constant in the code field (defaults to
* REASON_MESSAGE).
*
* @param string $userID The userID to check.
* @param array $credentials An array of login credentials.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
- throw new Horde_Exception('unsupported');
+ throw new Horde_Auth_Exception('unsupported');
}
/**
$auth = true;
}
}
- } catch (Horde_Exception $e) {
+ } catch (Horde_Auth_Exception $e) {
Horde::logMessage($e, __FILE__, __LINE__, PEAR_LOG_DEBUG);
Horde_Auth::setAuthError($e->getCode() || Horde_Auth::REASON_MESSAGE, $e->getMessage());
}
/**
* Authentication stub.
*
- * Horde_Exception should pass a message string (if any) in the message
+ * Horde_Auth_Exception should pass a message string (if any) in the message
* field, and the REASON_* constant in the code field (defaults to
* REASON_MESSAGE).
*
* @param string $userID The userID to check.
* @param array $credentials An array of login credentials.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
abstract protected function _authenticate($userId, $credentials);
* @param string $userId The userId to add.
* @param array $credentials The credentials to use.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function addUser($userId, $credentials)
{
- throw new Horde_Exception('unsupported');
+ throw new Horde_Auth_Exception('unsupported');
}
/**
* @param string $newID The new userId.
* @param array $credentials The new credentials
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function updateUser($oldID, $newID, $credentials)
{
- throw new Horde_Exception('unsupported');
+ throw new Horde_Auth_Exception('unsupported');
}
/**
*
* @param string $userId The userId to delete.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function removeUser($userId)
{
- throw new Horde_Exception('unsupported');
+ throw new Horde_Auth_Exception('unsupported');
}
/**
* Lists all users in the system.
*
* @return mixed The array of userIds.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function listUsers()
{
- throw new Horde_Exception('unsupported');
+ throw new Horde_Auth_Exception('unsupported');
}
/**
try {
$users = $this->listUsers();
return in_array($userId, $users);
- } catch (Horde_Exception $e) {
+ } catch (Horde_Auth_Exception $e) {
return false;
}
}
{
try {
return $this->_transparent();
- } catch (Horde_Exception $e) {
+ } catch (Horde_Auth_Exception $e) {
Horde_Auth::setAuthError($e->getCode() || Horde_Auth::REASON_MESSAGE, $e->getMessage());
return false;
}
/**
* Transparent authentication stub.
*
- * If the auth error message is desired to be set, Horde_Exception should
+ * If the auth error message is desired to be set, Horde_Auth_Exception should
* thrown instead of returning false.
- * The Horde_Exception object should have a message string (if any) in the
+ * The Horde_Auth_Exception object should have a message string (if any) in the
* message field, and the REASON_* constant in the code field (defaults to
* REASON_MESSAGE).
*
* @return boolean Whether transparent login is supported.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _transparent()
{
* @param string $userId The user id for which to reset the password.
*
* @return string The new password on success.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function resetPassword($userId)
{
- throw new Horde_Exception('unsupported');
+ throw new Horde_Auth_Exception('unsupported');
}
/**
* @param string $userId The userId to check.
* @param array $credentials The credentials to use.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
return;
}
- throw new Horde_Exception('', Horde_Auth::REASON_FAILED);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
}
/**
* @param string $userId The userId to add.
* @param array $credentials The credentials to use.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function addUser($userId, $credentials)
{
* @param string $newID The new userId.
* @param array $credentials The new credentials
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function updateUser($oldID, $newID, $credentials)
{
*
* @param string $userId The userId to delete.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function removeUser($userId)
{
* List all users in the system.
*
* @return array The array of userIds.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function listUsers()
{
* @param string $userId The userId to check.
* @param array $credentials The credentials to use.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
try {
$this->_connect();
- } catch (Horde_Exception $e) {
- throw new Horde_Exception('', Horde_Auth::REASON_FAILED);
+ } catch (Horde_Auth_Exception $e) {
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
}
/* Build a custom query, based on the config file. */
$result = $this->_db->query($query);
if ($result instanceof PEAR_Error) {
- throw new Horde_Exception('', Horde_Auth::REASON_FAILED);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
}
$row = $result->fetchRow(DB_GETMODE_ASSOC);
}
$result->free();
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
/**
* @param string $userId The userId to add.
* @param array $credentials The credentials to add.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function addUser($userId, $credentials)
{
$result = $this->_db->query($query);
if ($result instanceof PEAR_Error) {
- throw new Horde_Exception($result);
+ throw new Horde_Auth_Exception($result);
}
}
* @param string $newId The new userId.
* @param array $credentials The new credentials
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
function updateUser($oldId, $newId, $credentials)
{
$result = $this->_db->query($query);
if ($result instanceof PEAR_Error) {
- throw new Horde_Exception($result);
+ throw new Horde_Auth_Exception($result);
}
}
* @param string $userId The user id for which to reset the password.
*
* @return string The new password on success.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function resetPassword($userId)
{
$result = $this->_db->query($query);
if ($result instanceof PEAR_Error) {
- throw new Horde_Exception($result);
+ throw new Horde_Auth_Exception($result);
}
return $password;
*
* @param string $userId The userId to delete.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function removeUser($userId)
{
$result = $this->_db->query($query);
if ($result instanceof PEAR_Error) {
- throw new Horde_Exception($result);
+ throw new Horde_Auth_Exception($result);
}
$this->removeUserData($userId);
* List all users in the system.
*
* @return array The array of userIds.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function listUsers()
{
$result = $this->_db->getAll($query, null, DB_FETCHMODE_ORDERED);
if ($result instanceof PEAR_Error) {
- throw new Horde_Exception($result);
+ throw new Horde_Auth_Exception($result);
}
/* Loop through and build return array. */
{
try {
$this->_connect();
- } catch (Horde_Exception $e) {
+ } catch (Horde_Auth_Exception $e) {
return false;
}
* @param string $userId The userId to check.
* @param array $credentials The credentials to use.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
try {
$this->_connect();
- } catch (Horde_Exception $e) {
+ } catch (Horde_Auth_Exception $e) {
Horde::logMessage($e, __FILE__, __LINE__, PEAR_LOG_ERR);
- throw new Horde_Exception('', Horde_Auth::REASON_FAILED);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
}
if (!empty($this->_params['domain_field']) &&
$result = $this->_db->query($query, $values);
if ($result instanceof PEAR_Error) {
Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR);
- throw new Horde_Exception('', Horde_Auth::REASON_FAILED);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
}
$row = $result->fetchRow(DB_GETMODE_ASSOC);
if (is_array($row)) {
$result->free();
} else {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
if (!$this->_comparePasswords($row[$this->_params['password_field']],
$credentials['password'])) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
$now = time();
if (!empty($this->_params['hard_expiration_field']) &&
!empty($row[$this->_params['hard_expiration_field']]) &&
($now > $row[$this->_params['hard_expiration_field']])) {
- throw new Horde_Exception('', Horde_Auth::REASON_EXPIRED);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_EXPIRED);
}
if (!empty($this->_params['soft_expiration_field']) &&
* @param string $userId The userId to add.
* @param array $credentials The credentials to add.
*
- * @throw Horde_Exception
+ * @throw Horde_Auth_Exception
*/
public function addUser($userId, $credentials)
{
$dbresult2 = $this->_db->query($query, $values);
if ($dbresult2 instanceof PEAR_Error) {
- throw new Horde_Exception($dbresult2);
+ throw new Horde_Auth_Exception($dbresult2);
}
} else {
parent::addUser($userId, $credentials);
$ob->createMailbox($mailbox);
$ob->setACL($mailbox, $this->_params['cyradm'], 'lrswipcda');
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception($e);
+ throw new Horde_Auth_Exception($e);
}
foreach ($this->_params['folders'] as $folders) {
try {
$this->_ob->setQuota($mailbox, array('storage' => $this->_params['quota']));
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception($e);
+ throw new Horde_Auth_Exception($e);
}
}
if (isset($this->_params['quota']) &&
($this->_params['quota'] >= 0) &&
!@imap_set_quota($this->_imapStream, 'user' . $this->_separator . $userId, $this->_params['quota'])) {
- throw new Horde_Exception(sprintf(_("IMAP mailbox quota creation failed: %s"), imap_last_error()));
+ throw new Horde_Auth_Exception(sprintf(_("IMAP mailbox quota creation failed: %s"), imap_last_error()));
}
}
*
* @param string $userId The userId to delete.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
function removeUser($userId)
{
$this->_ob->setACL($mailbox, $admin, array('rights' => 'lrswipcda'));
$this->_ob->deleteMailbox($mailbox);
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception($e);
+ throw new Horde_Auth_Exception($e);
}
Horde_Auth::removeUserData($userId);
* List all users in the system.
*
* @return mixed The array of userIds.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function listUsers()
{
$result = $this->_db->getAll($query, null, DB_FETCHMODE_ORDERED);
if ($result instanceof PEAR_Error) {
- throw new Horde_Exception($result);
+ throw new Horde_Auth_Exception($result);
}
/* Loop through and build return array. */
* @param string $newID The new userId.
* @param array $credentials The new credentials
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function updateUser($oldID, $newID, $credentials)
{
$res = $this->_db->query($query, $values);
if ($res instanceof PEAR_Error) {
- throw new Horde_Exception($res);
+ throw new Horde_Auth_Exception($res);
}
}
/**
* Attempts to open connections to the SQL and IMAP servers.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _connect()
{
$this->_ob = Horde_Imap_Client::getInstance('Socket', $imap_config);
$this->_ob->login();
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception($e);
+ throw new Horde_Auth_Exception($e);
}
$this->_connected = true;
* @param string $userId The userId to add.
* @param array $credentials The credentials to add.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function addUser($userId, $credentials)
{
try {
$this->_ob->createMailbox($mailbox);
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception($e);
+ throw new Horde_Auth_Exception($e);
}
if (isset($this->_params['folders']) &&
try {
$this->_ob->setQuota($mailbox, array('storage' => $this->_params['quota']));
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception($e);
+ throw new Horde_Auth_Exception($e);
}
}
}
*
* @param string $userId The userId to delete.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function removeUser($userId)
{
$this->_ob->setACL($mailbox, $admin, array('rights' => 'lrswipcda'));
$this->_ob->deleteMailbox($mailbox);
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception($e);
+ throw new Horde_Auth_Exception($e);
}
Horde_Auth::removeUserData($userId);
/**
* Attempts to open connections to the IMAP servers.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _connect()
{
$this->_ob = Horde_Imap_Client::getInstance('Socket', $imap_config);
$this->_ob->login();
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception($e);
+ throw new Horde_Auth_Exception($e);
}
}
* List all users in the system.
*
* @return array The array of userIds.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function listUsers()
{
* @param string $newID The new userId.
* @param array $credentials The new credentials
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function updateUser($oldID, $newID, $credentials)
{
--- /dev/null
+<?php
+/**
+ * Authentication exceptions.
+ *
+ * Copyright 1999-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 Chuck Hagenbuch <chuck@horde.org>
+ * @author Michael Slusarz <slusarz@curecanti.org>
+ * @package Horde_Auth
+ */
+class Horde_Auth_Exception extends Horde_Exception
+{
+}
*
* @param array $params A hash containing connection parameters.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function __construct($params = array())
{
if (!Horde_Util::extensionExists('ftp')) {
- throw new Horde_Exception('Horde_Auth_Ftp: Required FTP extension not found. Compile PHP with the --enable-ftp switch.');
+ throw new Horde_Auth_Exception('Horde_Auth_Ftp: Required FTP extension not found. Compile PHP with the --enable-ftp switch.');
}
$params = array_merge(array(
* @param array $credentials An array of login credentials. For FTP,
* this must contain a password entry.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
@ftp_quit($ftp);
if ($res) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
}
* @param array $credentials An array of login credentials. For IMAP,
* this must contain a password entry.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
if (empty($credentials['password']) ||
empty($this->_users[$userId])) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
$hash = Horde_Auth::getCryptedPassword($credentials['password'], $this->_users[$userId], $this->_params['encryption'], !empty($this->_params['show_encryption']));
if ($hash != $this->_users[$userId]) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
}
* authentication info present.
*
* @return boolean Whether or not the client is allowed.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _transparent()
{
return Horde_Auth::setAuth(Horde_Util::dispelMagicQuotes($_SERVER['PHP_AUTH_USER']), array('password' => Horde_Util::dispelMagicQuotes($_SERVER['PHP_AUTH_PW']), 'transparent' => 1));
}
- throw new Horde_Exception(_("HTTP Authentication not found."));
+ throw new Horde_Auth_Exception(_("HTTP Authentication not found."));
}
}
* @param string $userId The userId to check.
* @param array $credentials An array of login credentials.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
$request->sendRequest();
if ($request->getResponseCode() != 200) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
}
* @param array $credentials An array of login credentials. For IMAP,
* this must contain a password entry.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
$ob->login();
$ob->logout();
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
}
* @param string $userId The userId to add.
* @param array $credentials The credentials to use.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function addUser($userId, $credentials)
{
$ob->createMailbox($mailbox);
$ob->setACL($mailbox, $this->_params['admin_user'], 'lrswipcda');
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception($e);
+ throw new Horde_Auth_Exception($e);
}
}
*
* @param string $userId The userId to delete.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function removeUser($userId)
{
$ob->setACL($mailbox, $this->_params['admin_user'], 'lrswipcda');
$ob->deleteMailbox(Horde_String::convertCharset($this->_params['userhierarchy'] . $userId, Horde_Nls::getCharset(), 'utf7-imap'));
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception($e);
+ throw new Horde_Auth_Exception($e);
}
Horde_Auth::removeUserData($userId);
* List all users in the system.
*
* @return array The array of userIds.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function listUsers()
{
$ob->_getOb($this->_params['admin_user'], $this->_params['admin_password']);
$list = $ob->listMailboxes($this->_params['userhierarchy'] . '%', Horde_Imap_Client::MBOX_ALL, array('flat' => true));
} catch (Horde_Imap_Client_Exception $e) {
- throw new Horde_Exception($e);
+ throw new Horde_Auth_Exception($e);
}
return empty($list)
$imsp = Net_IMSP_Auth::singleton($this->_params['auth_method']);
if ($imsp instanceof PEAR_Error) {
- throw new Horde_Exception($imsp->getMessage());
+ throw new Horde_Auth_Exception($imsp->getMessage());
}
$result = $imsp->authenticate($this->_params, false);
if ($result instanceof PEAR_Error) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
}
* block.
*
* @return boolean Whether or not the client is allowed.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _transparent()
{
if (!isset($_SERVER['REMOTE_ADDR'])) {
- throw new Horde_Exception(_("IP Address not avaialble."));
+ throw new Horde_Auth_Exception(_("IP Address not avaialble."));
}
$client = $_SERVER['REMOTE_ADDR'];
}
}
- throw new Horde_Exception(_("IP Address not within allowed CIDR block."));
+ throw new Horde_Auth_Exception(_("IP Address not within allowed CIDR block."));
}
/**
* @param array $credentials An array of login credentials. For Kolab,
* this must contain a "password" entry.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
try {
$session = Horde_Kolab_Session::singleton($userId, $credentials, true);
} catch (Horde_Kolab_Server_MissingObjectException $e) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
} catch (Exception $e) {
Horde::logMessage($e, __FILE__, __LINE__, PEAR_LOG_ERR);
- throw new Horde_Exception('', Horde_Auth::REASON_FAILED);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
}
} else {
- throw new Horde_Exception('The class Horde_Kolab_Session is required for the Kolab auth driver but it is missing!', Horde_Auth::REASON_MESSAGE);
+ throw new Horde_Auth_Exception('The class Horde_Kolab_Session is required for the Kolab auth driver but it is missing!', Horde_Auth::REASON_MESSAGE);
}
if (!isset($conf['auth']['params']) ||
'history_list' => $new_history_list), true);
if ($count > $max_count) {
- throw new Horde_Exception(_("Too many invalid logins during the last minutes."));
+ throw new Horde_Auth_Exception(_("Too many invalid logins during the last minutes."));
}
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
}
* List Users
*
* @return array List of Users
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function listUsers()
{
if (!class_exists('Horde_Kolab_Session')) {
- throw new Horde_Exception('The Horde_Kolab_Session class is not available.');
+ throw new Horde_Auth_Exception('The Horde_Kolab_Session class is not available.');
}
$session = Horde_Kolab_Session::singleton();
* @param string $userId The userId to add.
* @param array $credentials The credentials to be set.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function addUser($userId, $credentials)
{
if (!class_exists('Horde_Kolab_Session')) {
- throw new Horde_Exception('The Horde_Kolab_Session class is not available.');
+ throw new Horde_Auth_Exception('The Horde_Kolab_Session class is not available.');
}
$session = Horde_Kolab_Session::singleton();
} else if ($result instanceof PEAR_Error) {
return $result;
} else {
- throw new Horde_Exception(sprintf('The new Kolab object is a %s rather than a ' . KOLAB_OBJECT_USER, get_class($result)));
+ throw new Horde_Auth_Exception(sprintf('The new Kolab object is a %s rather than a ' . KOLAB_OBJECT_USER, get_class($result)));
}
}
*
* @param array $params Not used.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function __construct($params = array())
{
if (!Horde_Util::extensionExists('krb5')) {
- throw new Horde_Exception(_("Horde_Auth_Krb5: Required krb5 extension not found."));
+ throw new Horde_Auth_Exception(_("Horde_Auth_Krb5: Required krb5 extension not found."));
}
parent::__construct($params);
* For kerberos, this must contain a password
* entry.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
if (empty($credentials['password'])) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
$result = krb5_login($userId, $credentials['password']);
return;
case KRB5_BAD_PASSWORD:
- throw new Horde_Exception(_("Bad kerberos password."));
+ throw new Horde_Auth_Exception(_("Bad kerberos password."));
case KRB5_BAD_USER:
- throw new Horde_Exception(_("Bad kerberos username."));
+ throw new Horde_Auth_Exception(_("Bad kerberos username."));
default:
- throw new Horde_Exception(_("Kerberos server rejected authentication."));
+ throw new Horde_Auth_Exception(_("Kerberos server rejected authentication."));
}
}
*
* @param array $params A hash containing connection parameters.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function __construct($params = array())
{
if (!Horde_Util::extensionExists('ldap')) {
- throw new Horde_Exception(_("Horde_Auth_Ldap: Required LDAP extension not found."));
+ throw new Horde_Auth_Exception(_("Horde_Auth_Ldap: Required LDAP extension not found."));
}
/* Ensure we've been provided with all of the necessary parameters. */
/**
* Does an ldap connect and binds as the guest user or as the optional dn.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _connect()
{
/* Connect to the LDAP server. */
$this->_ds = @ldap_connect($this->_params['hostspec']);
if (!$this->_ds) {
- throw new Horde_Exception(_("Failed to connect to LDAP server."));
+ throw new Horde_Auth_Exception(_("Failed to connect to LDAP server."));
}
if (isset($this->_params['version'])) {
: @ldap_bind($this->_ds);
if (!$bind) {
- throw new Horde_Exception(_("Could not bind to LDAP server."));
+ throw new Horde_Auth_Exception(_("Could not bind to LDAP server."));
}
}
* @param string $userId The userId to find.
*
* @return string The users full DN
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _findDN($userId)
{
array($this->_params['uid']));
if (!$search) {
Horde::logMessage(ldap_error($this->_ds), __FILE__, __LINE__, PEAR_LOG_ERR);
- throw new Horde_Exception(_("Could not search the LDAP server."));
+ throw new Horde_Auth_Exception(_("Could not search the LDAP server."));
}
$result = @ldap_get_entries($this->_ds, $search);
if (is_array($result) && (count($result) > 1)) {
$dn = $result[0]['dn'];
} else {
- throw new Horde_Exception(_("Empty result."));
+ throw new Horde_Auth_Exception(_("Empty result."));
}
return $dn;
* @param string $userId The userId to check.
* @param array $credentials An array of login credentials.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
$bind = @ldap_bind($this->_ds, $dn, $credentials['password']);
if ($bind == false) {
@ldap_close($this->_ds);
- throw new Horde_Exception('', Horde_Auth::REASON_FAILED);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
}
if ($this->_params['password_expiration'] == 'yes') {
if ($toexpire == 0) {
$this->_authCredentials['changeRequested'] = true;
} elseif ($toexpire < 0) {
- throw new Horde_Exception('', Horde_Auth::REASON_EXPIRED);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_EXPIRED);
}
}
}
* @param string $userId The userId to add.
* @param array $credentials The credentials to be set.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function addUser($userId, $credentials)
{
if ($this->_params['ad']) {
- throw new Horde_Exception(_("Horde_Auth_Ldap: Adding users is not supported for Active Directory"));
+ throw new Horde_Auth_Exception(_("Horde_Auth_Ldap: Adding users is not supported for Active Directory"));
}
/* Connect to the LDAP server. */
$result = @ldap_add($this->_ds, $dn, $entry);
if (!$result) {
- throw new Horde_Exception(sprintf(_("Horde_Auth_Ldap: Unable to add user \"%s\". This is what the server said: "), $userId) . @ldap_error($this->_ds));
+ throw new Horde_Auth_Exception(sprintf(_("Horde_Auth_Ldap: Unable to add user \"%s\". This is what the server said: "), $userId) . @ldap_error($this->_ds));
}
@ldap_close($this->_ds);
*
* @param string $userId The userId to add.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function removeUser($userId)
{
if ($this->_params['ad']) {
- throw new Horde_Exception(_("Horde_Auth_Ldap: Removing users is not supported for Active Directory"));
+ throw new Horde_Auth_Exception(_("Horde_Auth_Ldap: Removing users is not supported for Active Directory"));
}
/* Connect to the LDAP server. */
$result = @ldap_delete($this->_ds, $dn);
if (!$result) {
- throw new Horde_Exception(sprintf(_("Auth_ldap: Unable to remove user \"%s\""), $userId));
+ throw new Horde_Auth_Exception(sprintf(_("Auth_ldap: Unable to remove user \"%s\""), $userId));
}
@ldap_close($this->_ds);
* @param string $newID The new userId.
* @param array $credentials The new credentials
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function updateUser($oldID, $newID, $credentials)
{
if ($this->_params['ad']) {
- throw new Horde_Exception(_("Horde_Auth_Ldap: Updating users is not supported for Active Directory."));
+ throw new Horde_Auth_Exception(_("Horde_Auth_Ldap: Updating users is not supported for Active Directory."));
}
/* Connect to the LDAP server. */
if ($shadow['shadowlastchange'] &&
$shadow['shadowmin'] &&
($shadow['shadowlastchange'] + $shadow['shadowmin'] > (time() / 86400))) {
- throw new Horde_Exception(_("Minimum password age has not yet expired"));
+ throw new Horde_Auth_Exception(_("Minimum password age has not yet expired"));
}
/* Set the lastchange field */
}
if (!$result) {
- throw new Horde_Exception(sprintf(_("Horde_Auth_Ldap: Unable to update user \"%s\""), $newID));
+ throw new Horde_Auth_Exception(sprintf(_("Horde_Auth_Ldap: Unable to update user \"%s\""), $newID));
}
@ldap_close($this->_ds);
* List Users
*
* @return array List of Users
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function listUsers()
{
protected function _authenticate($userId, $credentials)
{
if (empty($credentials['password'])) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
$proc = @popen($this->_location . ' -c /bin/true ' . $userId, 'w');
if (!is_resource($proc)) {
- throw new Horde_Exception('', Horde_Auth::REASON_FAILED);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
}
fwrite($proc, $credentials['password']);
if (@pclose($proc) !== 0) {
- throw new Horde_Exception('', Horde_Auth::REASON_FAILED);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
}
}
*
* @param array $params A hash containing connection parameters.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function __construct($params = array())
{
if (!Horde_Util::extensionExists('ldap')) {
- throw new Horde_Exception(_("Horde_Auth_Ldap: Required LDAP extension not found."));
+ throw new Horde_Auth_Exception(_("Horde_Auth_Ldap: Required LDAP extension not found."));
}
$params = array_merge(array(
* @param string $accountName The user sAMAccountName to find.
* @param array $credentials The credentials to be set.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function addUser($accountName, $credentials)
{
$success = @ldap_add($this->_ds, $dn, $entry);
if (!$success) {
- throw new Horde_Exception(sprintf(_("Auth_msad: Unable to add user \"%s\". This is what the server said: "), $accountName) . ldap_error($this->_ds));
+ throw new Horde_Auth_Exception(sprintf(_("Auth_msad: Unable to add user \"%s\". This is what the server said: "), $accountName) . ldap_error($this->_ds));
}
@ldap_close($this->_ds);
*
* @param string $accountName The user sAMAccountName to remove.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function removeUser($accountName)
{
: $entry['dn'];
if (!@ldap_delete($this->_ds, $dn)) {
- throw new Horde_Exception(sprintf(_("Horde_Auth_Msad: Unable to remove user \"%s\""), $accountName));
+ throw new Horde_Auth_Exception(sprintf(_("Horde_Auth_Msad: Unable to remove user \"%s\""), $accountName));
}
@ldap_close($this->_ds);
* @param string $newID The new userId.
* @param array $credentials The new credentials
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function updateUser($oldId, $newId, $credentials)
{
}
if (!$success) {
- throw new Horde_Exception(sprintf(_("Horde_Auth_Msad: Unable to update user \"%s\""), $newID), __FILE__, __LINE__);
+ throw new Horde_Auth_Exception(sprintf(_("Horde_Auth_Msad: Unable to update user \"%s\""), $newID), __FILE__, __LINE__);
}
@ldap_close($this->_ds);
* @param string $user_id The user id for which to reset the password.
*
* @return string The new password on success.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function resetPassword($user_id)
{
/**
* Does an ldap connect and binds as the guest user.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _connect()
{
*
* @param array $params A hash containing connection parameters.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function __construct($params = array())
{
if (!Horde_Util::extensionExists('pam')) {
- throw new Horde_Exception(_("PAM authentication is not available."));
+ throw new Horde_Auth_Exception(_("PAM authentication is not available."));
}
if (!empty($params['service'])) {
* @param string $userId The userId to check.
* @param array $credentials An array of login credentials.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
if (empty($credentials['password'])) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
$error = null;
if (!pam_auth($userId, $credentials['password'], $error)) {
- throw new Horde_Exception($error);
+ throw new Horde_Auth_Exception($error);
}
}
/**
* Read and, if requested, lock the password file.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _read()
{
}
if (empty($this->_params['filename'])) {
- throw new Horde_Exception('No password file set.');
+ throw new Horde_Auth_Exception('No password file set.');
}
if ($this->_params['lock']) {
$fp = fopen($this->_params['filename'], 'r');
if (!$fp) {
- throw new Horde_Exception("Couldn't open '" . $this->_params['filename'] . "'.");
+ throw new Horde_Auth_Exception("Couldn't open '" . $this->_params['filename'] . "'.");
}
$this->_users = array();
if (!empty($this->_params['group_filename'])) {
$fp = fopen($this->_params['group_filename'], 'r');
if (!$fp) {
- throw new Horde_Exception("Couldn't open '" . $this->_params['group_filename'] . "'.");
+ throw new Horde_Auth_Exception("Couldn't open '" . $this->_params['group_filename'] . "'.");
}
$this->_groups = array();
* @param array $credentials An array of login credentials. For MCAL,
* this must contain a password entry.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
if (empty($credentials['password'])) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
try {
$this->_read();
- } catch (Horde_Exception $e) {
+ } catch (Horde_Auth_Exception $e) {
Horde::logMessage($e, __FILE__, __LINE__, PEAR_LOG_ERR);
- throw new Horde_Exception('', Horde_Auth::REASON_FAILED);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
}
if (!isset($this->_users[$userId]) ||
!$this->_comparePasswords($this->_users[$userId]['password'], $credentials['password'])) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
if (!empty($this->_params['required_groups'])) {
}
if (!$allowed) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
}
}
* List all users in the system.
*
* @return array The array of userIds.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function listUsers()
{
* @param string $userId The userId to add.
* @param array $credentials The credentials to add.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function addUser($userId, $credentials)
{
$this->_read();
if (!$this->_locked) {
- throw new Horde_Exception('Password file not locked');
+ throw new Horde_Auth_Exception('Password file not locked');
}
if (isset($this->_users[$userId])) {
- throw new Horde_Exception("Couldn't add user '$user', because the user already exists.");
+ throw new Horde_Auth_Exception("Couldn't add user '$user', because the user already exists.");
}
$this->_users[$userId] = array(
* @param string $newID The new userId.
* @param array $credentials The new credentials
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function updateUser($oldID, $newID, $credentials)
{
$this->_read();
if (!$this->_locked) {
- throw new Horde_Exception('Password file not locked');
+ throw new Horde_Auth_Exception('Password file not locked');
}
if (!isset($this->_users[$userId])) {
- throw new Horde_Exception("Couldn't modify user '$oldID', because the user doesn't exist.");
+ throw new Horde_Auth_Exception("Couldn't modify user '$oldID', because the user doesn't exist.");
}
$this->_users[$newID] = array(
* @param string $userId The user id for which to reset the password.
*
* @return string The new password.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function resetPassword($userId)
{
*
* @param string $userId The userId to delete.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function removeUser($userId)
{
$this->_read();
if (!$this->_locked) {
- throw new Horde_Exception('Password file not locked');
+ throw new Horde_Auth_Exception('Password file not locked');
}
if (!isset($this->_users[$userId])) {
- throw new Horde_Exception("Couldn't delete user '$oldID', because the user doesn't exist.");
+ throw new Horde_Auth_Exception("Couldn't delete user '$oldID', because the user doesn't exist.");
}
unset($this->_users[$userId]);
*
* @param array $params A hash containing connection parameters.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function __construct($params = array())
{
if (!Horde_Util::extensionExists('sasl')) {
- throw new Horde_Exception('Horde_Auth_Peclsasl:: requires the sasl PECL extension to be loaded.');
+ throw new Horde_Auth_Exception('Horde_Auth_Peclsasl:: requires the sasl PECL extension to be loaded.');
}
$params = array_merge(array(
* @param string $userId The userId to check.
* @param array $credentials An array of login credentials.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
if (empty($credentials['password'])) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
$conn = sasl_server_new($this->_params['service']);
if (!is_resource($conn)) {
- throw new Horde_Exception(_("Failed to create new SASL connection."));
+ throw new Horde_Auth_Exception(_("Failed to create new SASL connection."));
}
if (!sasl_checkpass($conn, $userId, $credentials['password'])) {
- throw new Horde_Exception(sasl_errdetail($conn));
+ throw new Horde_Auth_Exception(sasl_errdetail($conn));
}
}
*
* @param array $params A hash containing connection parameters.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function __construct($params = array())
{
parent::__construct($params);
if (!Horde_Util::extensionExists('radius')) {
- throw new Horde_Exception('Horde_Auth_Radius:: requires the radius PECL extension to be loaded.');
+ throw new Horde_Auth_Exception('Horde_Auth_Radius:: requires the radius PECL extension to be loaded.');
}
/* A RADIUS host is required. */
if (empty($this->_params['host'])) {
- throw new Horde_Exception('Horde_Auth_Radius:: requires a RADIUS host to connect to.');
+ throw new Horde_Auth_Exception('Horde_Auth_Radius:: requires a RADIUS host to connect to.');
}
/* A RADIUS secret string is required. */
if (empty($this->_params['secret'])) {
- throw new Horde_Exception('Horde_Auth_Radius:: requires a RADIUS secret string.');
+ throw new Horde_Auth_Exception('Horde_Auth_Radius:: requires a RADIUS secret string.');
}
/* A RADIUS authentication method is required. */
if (empty($this->_params['method'])) {
- throw new Horde_Exception('Horde_Auth_Radius:: requires a RADIUS authentication method.');
+ throw new Horde_Auth_Exception('Horde_Auth_Radius:: requires a RADIUS authentication method.');
}
/* RADIUS NAS Identifier. */
* For radius, this must contain a password
* entry.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($username, $credentials)
{
/* Password is required. */
if (!isset($credentials['password'])) {
- throw new Horde_Exception(_("Password required for RADIUS authentication."));
+ throw new Horde_Auth_Exception(_("Password required for RADIUS authentication."));
}
$res = radius_auth_open();
break;
case RADIUS_ACCESS_REJECT:
- throw new Horde_Exception(_("Authentication rejected by RADIUS server."));
+ throw new Horde_Auth_Exception(_("Authentication rejected by RADIUS server."));
default:
- throw new Horde_Exception(radius_strerror($res));
+ throw new Horde_Auth_Exception(radius_strerror($res));
}
}
* configured header.
*
* @return boolean Whether or not the client is allowed.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _transparent()
{
if (empty($_SERVER[$this->_params['username_header']])) {
- throw new Horde_Exception(_("Shibboleth authentication not available."));
+ throw new Horde_Auth_Exception(_("Shibboleth authentication not available."));
}
$username = $_SERVER[$this->_params['username_header']];
*
* @param array $params A hash containing connection parameters.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function __construct($params = array())
{
if (!Horde_Util::extensionExists('smbauth')) {
- throw new Horde_Exception(_("Horde_Auth_Smb: Required smbauth extension not found."));
+ throw new Horde_Auth_Exception(_("Horde_Auth_Smb: Required smbauth extension not found."));
}
/* Ensure we've been provided with all of the necessary parameters. */
* @param string $userId The userId to check.
* @param array $credentials An array of login credentials.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function _authenticate($userId, $credentials)
{
if (empty($credentials['password'])) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
/* Authenticate. */
$credentials['password']);
if ($rval === 1) {
- throw new Horde_Exception(_("Failed to connect to SMB server."));
+ throw new Horde_Auth_Exception(_("Failed to connect to SMB server."));
} elseif ($rval !== 0) {
- throw new Horde_Exception(err2str());
+ throw new Horde_Auth_Exception(err2str());
}
}
* @param string $userId The userId to check.
* @param array $credentials An array of login credentials.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
if (empty($credentials['password'])) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
/* Authenticate. */
$sc = popen($cmdline, 'w');
if ($sc === false) {
- throw new Horde_Exception(_("Unable to execute smbclient."));
+ throw new Horde_Auth_Exception(_("Unable to execute smbclient."));
}
fwrite($sc, $credentials['password']);
$rc = pclose($sc);
if ((int)($rc & 0xff) != 0) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
}
* @param string $userId The userId to check.
* @param array $credentials The credentials to use.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
try {
$this->_connect();
- } catch (Horde_Exception $e) {
+ } catch (Horde_Auth_Exception $e) {
Horde::logMessage($e, __FILE__, __LINE__, PEAR_LOG_ERR);
- throw new Horde_Exception('', Horde_Auth::REASON_FAILED);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
}
/* Build the SQL query. */
$result = $this->_db->query($query, $values);
if ($result instanceof PEAR_Error) {
Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR);
- throw new Horde_Exception('', Horde_Auth::REASON_FAILED);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_FAILED);
}
$row = $result->fetchRow(DB_GETMODE_ASSOC);
if (is_array($row)) {
$result->free();
} else {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
if (!$this->_comparePasswords($row[$this->_params['password_field']],
$credentials['password'])) {
- throw new Horde_Exception('', Horde_Auth::REASON_BADLOGIN);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
}
$now = time();
if (!empty($this->_params['hard_expiration_field']) &&
!empty($row[$this->_params['hard_expiration_field']]) &&
($now > $row[$this->_params['hard_expiration_field']])) {
- throw new Horde_Exception('', Horde_Auth::REASON_EXPIRED);
+ throw new Horde_Auth_Exception('', Horde_Auth::REASON_EXPIRED);
}
if (!empty($this->_params['soft_expiration_field']) &&
* @param string $userId The userId to add.
* @param array $credentials The credentials to add.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function addUser($userId, $credentials)
{
$result = $this->_write_db->query($query, $values);
if ($result instanceof PEAR_Error) {
- throw new Horde_Exception($result);
+ throw new Horde_Auth_Exception($result);
}
}
* @param string $newID The new userId.
* @param array $credentials The new credentials
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function updateUser($oldID, $newID, $credentials)
{
$result = $this->_write_db->query($query, $values);
if ($result instanceof PEAR_Error) {
Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR);
- throw new Horde_Exception($result);
+ throw new Horde_Auth_Exception($result);
}
}
* @param string $userId The user id for which to reset the password.
*
* @return string The new password on success.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function resetPassword($userId)
{
$result = $this->_write_db->query($query, $values);
if ($result instanceof PEAR_Error) {
- throw new Horde_Exception($result);
+ throw new Horde_Auth_Exception($result);
}
return $password;
*
* @param string $userId The userId to delete.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function removeUser($userId)
{
$result = $this->_write_db->query($query, $values);
if ($result instanceof PEAR_Error) {
- throw new Horde_Exception($result);
+ throw new Horde_Auth_Exception($result);
}
Horde_Auth::removeUserData($userId);
* List all users in the system.
*
* @return array The array of userIds.
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
public function listUsers()
{
$res = $this->_db->getCol($query);
if ($res instanceof PEAR_Error) {
- throw new Horde_Exception($res);
+ throw new Horde_Auth_Exception($res);
}
return $res;
/**
* Attempts to open a connection to the SQL server.
*
- * @throws Horde_Exception
+ * @throws Horde_Auth_Exception
*/
function _connect()
{
array('persistent' => !empty($this->_params['persistent']),
'ssl' => !empty($this->_params['ssl'])));
if ($this->_write_db instanceof PEAR_Error) {
- throw new Horde_Exception($this->_write_db);
+ throw new Horde_Auth_Exception($this->_write_db);
}
// Set DB portability options.
array('persistent' => !empty($params['persistent']),
'ssl' => !empty($params['ssl'])));
if ($this->_db instanceof PEAR_Error) {
- throw new Horde_Exception($this->_db);
+ throw new Horde_Auth_Exception($this->_db);
}
switch ($this->_db->phptype) {
<file name="Customsql.php" role="php" />
<file name="Cyrsql.php" role="php" />
<file name="Cyrus.php" role="php" />
+ <file name="Exception.php" role="php" />
<file name="Ftp.php" role="php" />
<file name="Http.php" role="php" />
<file name="Imap.php" role="php" />
<install name="lib/Horde/Auth/Customsql.php" as="Horde/Auth/Customsql.php" />
<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/Exception.php" as="Horde/Auth/Exception.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" />