8000 [2.3][SECURITY] Add remember me cookie configuration by klaascuvelier · Pull Request #14491 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[2.3][SECURITY] Add remember me cookie configuration #14491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
Closed
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
const COOKIE_DELIMITER = ':';

protected $logger;
protected $options;
protected $options = array(
'secure' => false,
'httponly' => true,
);
private $providerKey;
private $key;
private $userProviders;
Expand Down Expand Up @@ -65,7 +68,7 @@ public function __construct(array $userProviders, $key, $providerKey, array $opt
$this->userProviders = $userProviders;
$this->key = $key;
$this->providerKey = $providerKey;
$this->options = $options;
$this->options = array_merge($this->options, $options);
$this->logger = $logger;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,8 @@ public function testLogout(array $options)
$request = new Request();
$response = new Response();
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');

$service->logout($request, $response, $token);

$cookie = $request->attributes->get(RememberMeServicesInterface::COOKIE_ATTR_NAME);

$this->assertInstanceOf('Symfony\Component\HttpFoundation\Cookie', $cookie);
$this->assertTrue($cookie->isCleared());
$this->assertSame($options['name'], $cookie->getName());
Expand Down Expand Up @@ -286,13 +283,6 @@ protected function getService($userProvider = null, $options = array(), $logger
$userProvider = $this->getProvider();
}

if (!isset($options['secure'])) {
$options['secure'] = false;
}
if (!isset($options['httponly'])) {
$options['httponly'] = true;
}

return $this->getMockForAbstractClass('Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices', array(
array($userProvider), 'fookey', 'fookey', $options, $logger,
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,6 @@ protected function getService($userProvider = null, $options = array(), $logger
$userProvider = $this->getProvider();
}

if (!isset($options['secure'])) {
$options['secure'] = false;
}
if (!isset($options['httponly'])) {
$options['httponly'] = true;
}

return new PersistentTokenBasedRememberMeServices(array($userProvider), 'fookey', 'fookey', $options, $logger, new SecureRandom(sys_get_temp_dir().'/_sf2.seed'));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,6 @@ protected function getService($userProvider = null, $options = array(), $logger
$userProvider = $this->getProvider();
}

if (!isset($options['secure'])) {
$options['secure'] = false;
}
if (!isset($options['httponly'])) {
$options['httponly'] = true;
}

$service = new TokenBasedRememberMeServices(array($userProvider), 'fookey', 'fookey', $options, $logger);

return $service;
Expand Down
0