/usr/share/php/Horde/Auth/Composite.php is in php-horde-auth 2.1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | <?php
/**
* Copyright 2002-2013 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you did
* not receive this file, http://www.horde.org/licenses/lgpl21
*
* @author Chuck Hagenbuch <chuck@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/lgpl21 LGPL-2.1
* @package Auth
*/
/**
* The Horde_Auth_Composite class provides a way to combine two separate
* drivers for admin vs. authentication purposes.
*
* @author Chuck Hagenbuch <chuck@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/lgpl21 LGPL-2.1
* @package Auth
*/
class Horde_Auth_Composite extends Horde_Auth_Base
{
/**
* Constructor.
*
* @param array $params Required parameters:
* <pre>
* 'admin_driver' - (Horde_Auth_Base) The admin driver.
* 'auth_driver' - (Horde_Auth_Base) The auth driver.
* </pre>
*
* @throws InvalidArgumentException
*/
public function __construct(array $params = array())
{
foreach (array('admin_driver', 'auth_driver') as $val) {
if (!isset($params[$val])) {
throw new InvalidArgumentException('Missing ' . $val . ' parameter.');
}
}
parent::__construct($params);
}
/**
* Find out if a set of login credentials are valid.
*
* @param string $userId The userId to check.
* @param array $credentials The credentials to use.
*
* @throws Horde_Auth_Exception
*/
protected function _authenticate($userId, $credentials)
{
if (!$this->_params['auth_driver']->authenticate($userId, $credentials)) {
throw new Horde_Auth_Exception($this->_params['auth_driver']->getError(true), $this->_params['auth_driver']->getError());
}
}
/**
* Query the current Auth object to find out if it supports the given
* capability.
*
* @param string $capability The capability to test for.
*
* @return boolean Whether or not the capability is supported.
*/
public function hasCapability($capability)
{
try {
return $this->_params['admin_driver']->hasCapability($capability);
} catch (Horde_Auth_Exception $e) {
return false;
}
}
/**
* Automatic authentication.
*
* @return boolean Whether or not the client is allowed.
*/
public function transparent()
{
try {
return $this->_params['auth_driver']->transparent();
} catch (Horde_Auth_Exception $e) {
return false;
}
}
/**
* Add a set of authentication credentials.
*
* @param string $userId The userId to add.
* @param array $credentials The credentials to use.
*
* @throws Horde_Auth_Exception
*/
public function addUser($userId, $credentials)
{
$this->_params['admin_driver']->addUser($userId, $credentials);
}
/**
* Update a set of authentication credentials.
*
* @param string $oldID The old userId.
* @param string $newID The new userId.
* @param array $credentials The new credentials
*
* @throws Horde_Auth_Exception
*/
public function updateUser($oldID, $newID, $credentials)
{
$this->_params['admin_driver']->updateUser($oldID, $newID, $credentials);
}
/**
* Reset a user's password. Used for example when the user does not
* remember the existing password.
*
* @param string $userId The user id for which to reset the password.
*
* @return string The new password on success.
* @throws Horde_Auth_Exception
*/
public function resetPassword($userId)
{
return $this->_params['admin_driver']->resetPassword($userId);
}
/**
* Delete a set of authentication credentials.
*
* @param string $userId The userId to delete.
*
* @throws Horde_Auth_Exception
*/
public function removeUser($userId)
{
$this->_params['admin_driver']->removeUser($userId);
}
/**
* Lists all users in the system.
*
* @param boolean $sort Sort the users?
*
* @return array The array of userIds.
* @throws Horde_Auth_Exception
*/
public function listUsers($sort = false)
{
return $this->_params['admin_driver']->listUsers($sort);
}
/**
* Checks if a userId exists in the system.
*
* @param string $userId User ID to check
*
* @return boolean Whether or not the userId already exists.
*/
public function exists($userId)
{
try {
return $this->_params['admin_driver']->exists($userId);
} catch (Horde_Auth_Exception $e) {
return false;
}
}
}
|