Development

#8930 (Problem with sfGuardRememberMeFilter)

You must first sign up to be able to contribute.

Ticket #8930 (new defect)

Opened 3 years ago

Problem with sfGuardRememberMeFilter

Reported by: Nafanya Assigned to: fabien
Priority: minor Milestone: plugins
Component: sfGuardPlugin Version: 1.4.6
Keywords: is_secure, sfGuardAuth, filter Cc:
Qualification: Unreviewed

Description

I think that there is error in the new filter. After any case after these corrections at me all has earned correctly.

The problem description: if in files security.yml it is established is_secure: true the filter doesn't throw on login page (correct me if I am not right)

My decision:

<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * Processes the "remember me" cookie.
 *
 * This filter should be added to the application filters.yml file **above**
 * the security filter:
 *
 *    remember_me:
 *      class: sfGuardRememberMeFilter
 *
 *    security: ~
 *
 * @package    symfony
 * @subpackage plugin
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
 * @version    SVN: $Id: sfGuardRememberMeFilter.class.php 15757 2009-02-24 21:15:40Z Kris.Wallsmith $
 */
class sfGuardRememberMeFilter extends sfBasicSecurityFilter // <<<<<<<<<<<<<<<<<<<<<
{
  /**
   * @see sfFilter
   */
  public function execute($filterChain)
  {
    $cookieName = sfConfig::get('app_sf_guard_plugin_remember_cookie_name', 'sfRemember');

    if (
      $this->isFirstCall()
      &&
      $this->context->getUser()->isAnonymous()
      &&
      $cookie = $this->context->getRequest()->getCookie($cookieName)
    )
    {
      $criteria = new Criteria();
      $criteria->add(sfGuardRememberKeyPeer::REMEMBER_KEY, $cookie);

      if ($rk = sfGuardRememberKeyPeer::doSelectOne($criteria))
      {
        $this->context->getUser()->signIn($rk->getsfGuardUser());
      }
    }

    //$filterChain->execute();
    parent::execute($filterChain); //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  }
}