Browse Source

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

José Lorenzo Rodríguez 15 years ago
parent
commit
0cb08a09dc
1 changed files with 10 additions and 4 deletions
  1. 10 4
      lib/Cake/Network/Http/HttpSocket.php

+ 10 - 4
lib/Cake/Network/Http/HttpSocket.php

@@ -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')) {