import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_Auth_Adapter
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: DbTable.php 16200 2009-06-21 18:50:06Z thomas $
|
||||
* @version $Id: DbTable.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
|
||||
* @var Zend_Db_Select
|
||||
*/
|
||||
protected $_dbSelect = null;
|
||||
|
||||
|
||||
/**
|
||||
* $_tableName - the table name to check
|
||||
*
|
||||
@ -241,10 +241,10 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
|
||||
if ($this->_dbSelect == null) {
|
||||
$this->_dbSelect = $this->_zendDb->select();
|
||||
}
|
||||
|
||||
|
||||
return $this->_dbSelect;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getResultRowObject() - Returns the result row as a stdClass object
|
||||
*
|
||||
@ -373,7 +373,9 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
|
||||
. ' = ' . $this->_credentialTreatment, $this->_credential
|
||||
)
|
||||
. ' THEN 1 ELSE 0 END) AS '
|
||||
. $this->_zendDb->quoteIdentifier('zend_auth_credential_match')
|
||||
. $this->_zendDb->quoteIdentifier(
|
||||
$this->_zendDb->foldCase('zend_auth_credential_match')
|
||||
)
|
||||
);
|
||||
|
||||
// get select
|
||||
@ -426,7 +428,6 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
|
||||
protected function _authenticateValidateResultSet(array $resultIdentities)
|
||||
{
|
||||
|
||||
|
||||
if (count($resultIdentities) < 1) {
|
||||
$this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
|
||||
$this->_authenticateResultInfo['messages'][] = 'A record with the supplied identity could not be found.';
|
||||
@ -449,13 +450,15 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
|
||||
*/
|
||||
protected function _authenticateValidateResult($resultIdentity)
|
||||
{
|
||||
if ($resultIdentity['zend_auth_credential_match'] != '1') {
|
||||
$zendAuthCredentialMatchColumn = $this->_zendDb->foldCase('zend_auth_credential_match');
|
||||
|
||||
if ($resultIdentity[$zendAuthCredentialMatchColumn] != '1') {
|
||||
$this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
|
||||
$this->_authenticateResultInfo['messages'][] = 'Supplied credential is invalid.';
|
||||
return $this->_authenticateCreateAuthResult();
|
||||
}
|
||||
|
||||
unset($resultIdentity['zend_auth_credential_match']);
|
||||
unset($resultIdentity[$zendAuthCredentialMatchColumn]);
|
||||
$this->_resultRow = $resultIdentity;
|
||||
|
||||
$this->_authenticateResultInfo['code'] = Zend_Auth_Result::SUCCESS;
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_Auth_Adapter_Http
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Http.php 16200 2009-06-21 18:50:06Z thomas $
|
||||
* @version $Id: Http.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -403,7 +403,7 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
|
||||
// challenge again the client
|
||||
return $this->_challengeClient();
|
||||
}
|
||||
|
||||
|
||||
switch ($clientScheme) {
|
||||
case 'basic':
|
||||
$result = $this->_basicAuth($authHeader);
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_Auth_Adapter
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Ldap.php 17788 2009-08-24 14:43:23Z sgehrig $
|
||||
* @version $Id: Ldap.php 18882 2009-11-06 10:57:58Z sgehrig $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -161,7 +161,7 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
|
||||
/**
|
||||
* setIdentity() - set the identity (username) to be used
|
||||
*
|
||||
* Proxies to {@see setPassword()}
|
||||
* Proxies to {@see setUsername()}
|
||||
*
|
||||
* Closes ZF-6813
|
||||
*
|
||||
@ -312,10 +312,16 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
|
||||
continue;
|
||||
}
|
||||
|
||||
$ldap->bind($username, $password);
|
||||
|
||||
$canonicalName = $ldap->getCanonicalAccountName($username);
|
||||
$dn = $ldap->getCanonicalAccountName($username, Zend_Ldap::ACCTNAME_FORM_DN);
|
||||
$ldap->bind($canonicalName, $password);
|
||||
/*
|
||||
* Fixes problem when authenticated user is not allowed to retrieve
|
||||
* group-membership information or own account.
|
||||
* This requires that the user specified with "username" and "password"
|
||||
* in the Zend_Ldap options is able to retrieve the required information.
|
||||
*/
|
||||
$ldap->bind();
|
||||
$dn = $ldap->getCanonicalAccountName($canonicalName, Zend_Ldap::ACCTNAME_FORM_DN);
|
||||
|
||||
$groupResult = $this->_checkGroupMembership($ldap, $canonicalName, $dn, $adapterOptions);
|
||||
if ($groupResult === true) {
|
||||
@ -323,6 +329,8 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
|
||||
$messages[0] = '';
|
||||
$messages[1] = '';
|
||||
$messages[] = "$canonicalName authentication successful";
|
||||
// rebinding with authenticated user
|
||||
$ldap->bind($dn, $password);
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $canonicalName, $messages);
|
||||
} else {
|
||||
$messages[0] = 'Account is not a member of the specified group';
|
||||
@ -409,7 +417,6 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ldap->setOptions($options);
|
||||
return $adapterOptions;
|
||||
}
|
||||
@ -463,9 +470,10 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
|
||||
* Closes ZF-6813
|
||||
*
|
||||
* @param array $returnAttribs
|
||||
* @param array $omitAttribs
|
||||
* @return stdClass|boolean
|
||||
*/
|
||||
public function getAccountObject(array $returnAttribs = array())
|
||||
public function getAccountObject(array $returnAttribs = array(), array $omitAttribs = array())
|
||||
{
|
||||
if (!$this->_authenticatedDn) {
|
||||
return false;
|
||||
@ -473,8 +481,14 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
|
||||
|
||||
$returnObject = new stdClass();
|
||||
|
||||
$omitAttribs = array_map('strtolower', $omitAttribs);
|
||||
|
||||
$entry = $this->getLdap()->getEntry($this->_authenticatedDn, $returnAttribs, true);
|
||||
foreach ($entry as $attr => $value) {
|
||||
if (in_array($attr, $omitAttribs)) {
|
||||
// skip attributes marked to be omitted
|
||||
continue;
|
||||
}
|
||||
if (is_array($value)) {
|
||||
$returnObject->$attr = (count($value) > 1) ? $value : $value[0];
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user