Skip to content
Permalink
Browse files

Allowing same Authenticate object to be setup with different settings.

  • Loading branch information...
renan committed May 6, 2014
1 parent 23519e1 commit 87683b10f149af398900cec65951335cf83e05c4
@@ -776,6 +776,10 @@ public function constructAuthenticate() {
unset($config[AuthComponent::ALL]);
}
foreach ($config as $class => $settings) {
if (!empty($settings['className'])) {
$class = $settings['className'];
unset($settings['className']);
}
list($plugin, $class) = pluginSplit($class, true);
$className = $class . 'Authenticate';
App::uses($className, $plugin . 'Controller/Component/Auth');
@@ -590,6 +590,27 @@ public function testAllConfigWithAuthenticate() {
$this->assertEquals('AuthUser', $result->settings['userModel']);
}
/**
* test defining the same Authenticate object but with different password hashers
*
* @return void
*/
public function testSameAuthenticateWithDifferentHashers() {
$this->Controller->Auth->authenticate = array(
'FormSimple' => array('className' => 'Form', 'passwordHasher' => 'Simple'),
'FormBlowfish' => array('className' => 'Form', 'passwordHasher' => 'Blowfish'),
);
$objects = $this->Controller->Auth->constructAuthenticate();
$this->assertEquals(2, count($objects));
$this->assertInstanceOf('FormAuthenticate', $objects[0]);
$this->assertInstanceOf('FormAuthenticate', $objects[1]);
$this->assertInstanceOf('SimplePasswordHasher', $objects[0]->passwordHasher());
$this->assertInstanceOf('BlowfishPasswordHasher', $objects[1]->passwordHasher());
}
/**
* Tests that deny always takes precedence over allow
*

0 comments on commit 87683b1

Please sign in to comment.
You can’t perform that action at this time.