Fixing class loading for authentication clasess in HttpSocket, also allowing the use of plugin authentication classes

This commit is contained in:
José Lorenzo Rodríguez 2011-02-21 23:58:46 -04:30
parent b314149efd
commit 0cb08a09dc

View file

@ -530,8 +530,11 @@ class HttpSocket extends CakeSocket {
return;
}
$method = key($this->_auth);
$authClass = Inflector::camelize($method) . 'Authentication';
if (!App::import('Lib', 'http/' . $authClass)) {
list($plugin, $authClass) = pluginSplit($method, true);
$authClass = Inflector::camelize($authClass) . 'Authentication';
App::uses($authClass, $plugin . 'Network/Http');
if (!class_exists($authClass)) {
throw new SocketException(__('Unknown authentication method.'));
}
if (!method_exists($authClass, 'authentication')) {
@ -556,8 +559,11 @@ class HttpSocket extends CakeSocket {
if (empty($this->_proxy['method']) || !isset($this->_proxy['user'], $this->_proxy['pass'])) {
return;
}
$authClass = Inflector::camelize($this->_proxy['method']) . 'Authentication';
if (!App::import('Lib', 'http/' . $authClass)) {
list($plugin, $authClass) = pluginSplit($this->_proxy['method'], true);
$authClass = Inflector::camelize($authClass) . 'Authentication';
App::uses($authClass, $plugin. 'Network/Http');
if (!class_exists($authClass)) {
throw new SocketException(__('Unknown authentication method for proxy.'));
}
if (!method_exists($authClass, 'proxyAuthentication')) {