PHP Class FOC\Authenticate\Auth\CookieAuthenticate

Provides the ability to authenticate using COOKIE $this->Auth->config('authenticate', [ 'Authenticate.Cookie' => [ 'fields' => [ 'username' => 'username', 'password' => 'password' ], 'userModel' => 'Users', 'scope' => ['Users.active' => 1], 'crypt' => 'aes', 'cookie' => [ 'name' => 'RememberMe', 'time' => '+2 weeks', ] ] ]); Licensed under The MIT License For full copyright and license information, please see the LICENSE.txt
Inheritance: extends Cake\Auth\BaseAuthenticate
Show file Open project: friendsofcake/authenticate

Public Methods

Method Description
__construct ( Cake\Controller\ComponentRegistry $registry, array $config ) Constructor
authenticate ( Cake\Network\Request $request, Response $response ) : array | boolean Authenticate user
getUser ( Cake\Network\Request $request ) : mixed Authenticates the identity contained in the cookie. Will use the userModel config, and fields config to find COOKIE data that is used to find a matching record in the model specified by userModel. Will return false if there is no cookie data, either username or password is missing, or if the scope conditions have not been met.
logout ( Cake\Event\Event $event, array $user ) : void Called from AuthComponent::logout()

Method Details

__construct() public method

Constructor
public __construct ( Cake\Controller\ComponentRegistry $registry, array $config )
$registry Cake\Controller\ComponentRegistry The Component registry used on this request.
$config array Array of config to use.

authenticate() public method

Authenticate user
public authenticate ( Cake\Network\Request $request, Response $response ) : array | boolean
$request Cake\Network\Request Request object.
$response Cake\Network\Response Response object.
return array | boolean Array of user info on success, false on falure.

getUser() public method

Authenticates the identity contained in the cookie. Will use the userModel config, and fields config to find COOKIE data that is used to find a matching record in the model specified by userModel. Will return false if there is no cookie data, either username or password is missing, or if the scope conditions have not been met.
public getUser ( Cake\Network\Request $request ) : mixed
$request Cake\Network\Request The unused request object.
return mixed False on login failure. An array of User data on success.

logout() public method

Called from AuthComponent::logout()
public logout ( Cake\Event\Event $event, array $user ) : void
$event Cake\Event\Event The dispatched Auth.logout event.
$user array User record.
return void