Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added triggering of Auth.afterIdentify and Auth.logout events.
Auth.afterIdentify is triggered after a user has been identified. BaseAuthenticate::logout() has been removed, instead authenticate classes should add listener for Auth.logout event if needed.
- Loading branch information
Showing
4 changed files
with
87 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/** | ||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) | ||
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) | ||
* | ||
* Licensed under The MIT License | ||
* Redistributions of files must retain the above copyright notice. | ||
* | ||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) | ||
* @link http://cakephp.org CakePHP(tm) Project | ||
* @since 3.0.0 | ||
* @license http://www.opensource.org/licenses/mit-license.php MIT License | ||
*/ | ||
namespace TestApp\Auth; | ||
|
||
use Cake\Auth\BaseAuthenticate; | ||
use Cake\Event\Event; | ||
use Cake\Network\Request; | ||
use Cake\Network\Response; | ||
|
||
/** | ||
* TestAuthenticate class | ||
* | ||
*/ | ||
class TestAuthenticate extends BaseAuthenticate { | ||
|
||
public $callStack = []; | ||
|
||
public function implementedEvents() { | ||
return [ | ||
'Auth.afterIdentify' => 'afterIdentify', | ||
'Auth.logout' => 'logout' | ||
]; | ||
} | ||
|
||
public function authenticate(Request $request, Response $response) { | ||
return ['id' => 1, 'username' => 'admad']; | ||
} | ||
|
||
public function afterIdentify(Event $event, array $user) { | ||
$this->callStack[] = __FUNCTION__; | ||
} | ||
|
||
public function logout(Event $event, array $user) { | ||
$this->callStack[] = __FUNCTION__; | ||
} | ||
|
||
} |