public function authenticate(Request $request, Response $response)
    {
        if (!isset($this->_registry->Cookie) || !$this->_registry->Cookie instanceof CookieComponent) {
            throw new \RuntimeException('You need to load the CookieComponent.');
        }

        $cookies = $this->_registry->Cookie->read($this->_config['cookie']['name']);
        if (empty($cookies)) {
            return false;
        }

        extract($this->_config['fields']);
        if (empty($cookies[$username]) || empty($cookies[$password])) {
            return false;
        }

        $user = $this->_findUser($cookies[$username], $cookies[$password]);
        if ($user) {
            return $user;
        }

        return false;
    }
public function authenticate(Request $request, Response $response)
    {
        if (!isset($this->_registry->Cookie) || !$this->_registry->Cookie instanceof CookieComponent) {
            throw new \RuntimeException('You need to load the CookieComponent.');
        }

        $cookies = $this->_registry->Cookie->read($this->_config['cookie']['name']);
        if (empty($cookies)) {
            return false;
        }

        extract($this->_config['fields']);
        if (empty($cookies[$username]) || empty($cookies[$password])) {
            return false;
        }

        $user = $this->_findUser($cookies[$username], $cookies[$password]);
        if ($user) {
            return $user;
        }

        return false;
    }
public function authenticate ( Request $ request , Response $ response ) { if ( ! isset ( $ this -> _registry -> Cookie ) || ! $ this -> _registry -> Cookie instanceof CookieComponent ) { throw new \ RuntimeException ( 'You need to load the CookieComponent.' ) ; } $ cookies = $ this -> _registry -> Cookie -> read ( $ this -> _config [ 'cookie' ] [ 'name' ] ) ; if ( empty ( $ cookies ) ) { return false ; } extract ( $ this -> _config [ 'fields' ] ) ; if ( empty ( $ cookies [ $ username ] ) || empty ( $ cookies [ $ password ] ) ) { return false ; } $ user = $ this -> _findUser ( $ cookies [ $ username ] , $ cookies [ $ password ] ) ; if ( $ user ) { return $ user ; } return false ; }
Authenticate a user based on the cookies information.

@param \Cake\Network\Request  $request  The request instance.
@param \Cake\Network\Response $response The response instance.

@return mixed

@throws \RuntimeException When the CookieComponent is not loaded.
Authenticate a user based on the cookies information .