Skip to content

Commit

Permalink
Fixing class loading for authentication clasess in HttpSocket, also a…
Browse files Browse the repository at this point in the history
…llowing the use of plugin authentication classes
  • Loading branch information
lorenzo committed Feb 22, 2011
1 parent b314149 commit 0cb08a0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/Cake/Network/Http/HttpSocket.php
Expand Up @@ -530,8 +530,11 @@ protected function _setAuth() {
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')) {
Expand All @@ -556,8 +559,11 @@ protected function _setProxy() {
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')) {
Expand Down

0 comments on commit 0cb08a0

Please sign in to comment.