Skip to content

Commit

Permalink
Move files to Cake\Auth
Browse files Browse the repository at this point in the history
  • Loading branch information
rchavik committed Jun 5, 2014
1 parent 5ddda55 commit de1d354
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 41 deletions.
Expand Up @@ -12,7 +12,7 @@
* @since 2.4.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Component\Auth;
namespace Cake\Auth;

use Cake\Core\InstanceConfigTrait;

Expand Down
Expand Up @@ -11,10 +11,11 @@
* @link http://cakephp.org CakePHP(tm) Project
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Component\Auth;
namespace Cake\Auth;

use Cake\Auth\AbstractPasswordHasher;
use Cake\Auth\PasswordHasherFactory;
use Cake\Controller\ComponentRegistry;
use Cake\Controller\Component\Auth\PasswordHasherFactory;
use Cake\Core\App;
use Cake\Core\InstanceConfigTrait;
use Cake\Error;
Expand Down
Expand Up @@ -12,7 +12,7 @@
* @since 2.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Component\Auth;
namespace Cake\Auth;

use Cake\Controller\ComponentRegistry;
use Cake\Controller\Controller;
Expand Down
Expand Up @@ -13,7 +13,7 @@
* @since 2.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Component\Auth;
namespace Cake\Auth;

use Cake\Controller\ComponentRegistry;
use Cake\Error;
Expand Down
Expand Up @@ -12,7 +12,7 @@
* @since 2.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Component\Auth;
namespace Cake\Auth;

use Cake\Controller\ComponentRegistry;
use Cake\Controller\Controller;
Expand Down
Expand Up @@ -13,10 +13,10 @@
* @since 2.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Component\Auth;
namespace Cake\Auth;

use Cake\Auth\BasicAuthenticate;
use Cake\Controller\ComponentRegistry;
use Cake\Controller\Component\Auth\BasicAuthenticate;
use Cake\Network\Request;
use Cake\Network\Response;

Expand Down
Expand Up @@ -12,9 +12,9 @@
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Component\Auth;
namespace Cake\Auth;

use Cake\Controller\Component\Auth\AbstractPasswordHasher;
use Cake\Auth\AbstractPasswordHasher;

/**
* A password hasher that can use multiple different hashes where only
Expand Down
Expand Up @@ -13,7 +13,7 @@
* @since 2.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Component\Auth;
namespace Cake\Auth;

use Cake\Controller\ComponentRegistry;
use Cake\Network\Request;
Expand Down
Expand Up @@ -12,7 +12,7 @@
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Component\Auth;
namespace Cake\Auth;

use Cake\Core\App;

Expand Down Expand Up @@ -42,7 +42,7 @@ public static function build($passwordHasher) {
}

list($plugin, $class) = pluginSplit($class, true);
$className = App::className($class, 'Controller/Component/Auth', 'PasswordHasher');
$className = App::className($class, 'Auth', 'PasswordHasher');
if (!class_exists($className)) {
throw new \RuntimeException(sprintf('Password hasher class "%s" was not found.', $class));
}
Expand Down
Expand Up @@ -12,9 +12,9 @@
* @since 2.4.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Component\Auth;
namespace Cake\Auth;

use Cake\Controller\Component\Auth\AbstractPasswordHasher;
use Cake\Auth\AbstractPasswordHasher;
use Cake\Utility\Security;

/**
Expand Down
Expand Up @@ -12,9 +12,9 @@
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Controller\Component\Auth;
namespace Cake\Auth;

use Cake\Controller\Component\Auth\AbstractPasswordHasher;
use Cake\Auth\AbstractPasswordHasher;
use Cake\Utility\Security;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Component/AuthComponent.php
Expand Up @@ -479,7 +479,7 @@ public function constructAuthorize() {
unset($authorize[AuthComponent::ALL]);
}
foreach ($authorize as $class => $config) {
$className = App::className($class, 'Controller/Component/Auth', 'Authorize');
$className = App::className($class, 'Auth', 'Authorize');
if (!class_exists($className)) {
throw new Error\Exception(sprintf('Authorization adapter "%s" was not found.', $class));
}
Expand Down Expand Up @@ -750,7 +750,7 @@ public function constructAuthenticate() {
$class = $config['className'];
unset($config['className']);
}
$className = App::className($class, 'Controller/Component/Auth', 'Authenticate');
$className = App::className($class, 'Auth', 'Authenticate');
if (!class_exists($className)) {
throw new Error\Exception(sprintf('Authentication adapter "%s" was not found.', $class));
}
Expand Down
Expand Up @@ -14,9 +14,9 @@
* @since 2.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Test\TestCase\Controller\Component\Auth;
namespace Cake\Test\TestCase\Auth;

use Cake\Controller\Component\Auth\BasicAuthenticate;
use Cake\Auth\BasicAuthenticate;
use Cake\Error;
use Cake\Network\Request;
use Cake\ORM\Entity;
Expand Down
Expand Up @@ -14,9 +14,9 @@
* @since 2.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Test\TestCase\Controller\Component\Auth;
namespace Cake\Test\TestCase\Auth;

use Cake\Controller\Component\Auth\ControllerAuthorize;
use Cake\Auth\ControllerAuthorize;
use Cake\Controller\Controller;
use Cake\Network\Request;
use Cake\TestSuite\TestCase;
Expand Down
Expand Up @@ -14,9 +14,9 @@
* @since 2.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Test\TestCase\Controller\Component\Auth;
namespace Cake\Test\TestCase\Auth;

use Cake\Controller\Component\Auth\DigestAuthenticate;
use Cake\Auth\DigestAuthenticate;
use Cake\Error;
use Cake\Network\Request;
use Cake\ORM\Entity;
Expand Down
Expand Up @@ -12,11 +12,11 @@
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Test\TestCase\Controller\Component\Auth;
namespace Cake\Test\TestCase\Auth;

use Cake\Controller\Component\Auth\FallbackPasswordHasher;
use Cake\Controller\Component\Auth\SimplePasswordHasher;
use Cake\Controller\Component\Auth\WeakPasswordHasher;
use Cake\Auth\FallbackPasswordHasher;
use Cake\Auth\SimplePasswordHasher;
use Cake\Auth\WeakPasswordHasher;
use Cake\TestSuite\TestCase;

/**
Expand Down
Expand Up @@ -14,10 +14,10 @@
* @since 2.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Test\TestCase\Controller\Component\Auth;
namespace Cake\Test\TestCase\Auth;

use Cake\Auth\FormAuthenticate;
use Cake\Cache\Cache;
use Cake\Controller\Component\Auth\FormAuthenticate;
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\Plugin;
Expand Down Expand Up @@ -133,7 +133,7 @@ public function testAuthenticatePasswordIsEmptyString() {
];

$this->auth = $this->getMock(
'Cake\Controller\Component\Auth\FormAuthenticate',
'Cake\Auth\FormAuthenticate',
['_checkFields'],
[
$this->Collection,
Expand Down
Expand Up @@ -12,9 +12,9 @@
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Test\TestCase\Controller\Component\Auth;
namespace Cake\Test\TestCase\Auth;

use Cake\Controller\Component\Auth\SimplePasswordHasher;
use Cake\Auth\SimplePasswordHasher;
use Cake\TestSuite\TestCase;

/**
Expand Down
Expand Up @@ -12,9 +12,9 @@
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Test\TestCase\Controller\Component\Auth;
namespace Cake\Test\TestCase\Auth;

use Cake\Controller\Component\Auth\WeakPasswordHasher;
use Cake\Auth\WeakPasswordHasher;
use Cake\TestSuite\TestCase;

/**
Expand Down
10 changes: 5 additions & 5 deletions tests/TestCase/Controller/Component/AuthComponentTest.php
Expand Up @@ -331,7 +331,7 @@ public function testLoadAuthenticateNoFile() {
public function testAllConfigWithAuthorize() {
$this->Controller->Auth->config('authorize', [
AuthComponent::ALL => array('actionPath' => 'controllers/'),
'Actions'
'Controller',
]);
$objects = $this->Controller->Auth->constructAuthorize();
$result = $objects[0];
Expand Down Expand Up @@ -381,11 +381,11 @@ public function testSameAuthenticateWithDifferentHashers() {
$objects = $this->Controller->Auth->constructAuthenticate();
$this->assertEquals(2, count($objects));

$this->assertInstanceOf('Cake\Controller\Component\Auth\FormAuthenticate', $objects[0]);
$this->assertInstanceOf('Cake\Controller\Component\Auth\FormAuthenticate', $objects[1]);
$this->assertInstanceOf('Cake\Auth\FormAuthenticate', $objects[0]);
$this->assertInstanceOf('Cake\Auth\FormAuthenticate', $objects[1]);

$this->assertInstanceOf('Cake\Controller\Component\Auth\SimplePasswordHasher', $objects[0]->passwordHasher());
$this->assertInstanceOf('Cake\Controller\Component\Auth\FallbackPasswordHasher', $objects[1]->passwordHasher());
$this->assertInstanceOf('Cake\Auth\SimplePasswordHasher', $objects[0]->passwordHasher());
$this->assertInstanceOf('Cake\Auth\FallbackPasswordHasher', $objects[1]->passwordHasher());
}

/**
Expand Down

0 comments on commit de1d354

Please sign in to comment.