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
Prev Previous commit
Next Next commit
Use array_merge to set default options
  • Loading branch information
klaascuvelier committed Oct 6, 2015
commit 73d7fd94eaabe7dc227afcdc3b481bc4e62fe0a3
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 Expand Up @@ -293,6 +296,7 @@ protected function cancelCookie(Request $request)
$this->logger->debug(sprintf('Clearing remember-me cookie "%s"', $this->options['name']));
}


// Hard coded the default values for secure and http only, would be better if these where constants
$request->attributes->set(
self::COOKIE_ATTR_NAME,
Expand All @@ -301,8 +305,8 @@ protected function cancelCookie(Request $request)
1,
$this->options['path'],
$this->options['domain'],
isset($this->options['secure']) ? $this->options['secure'] : false,
isset($this->options['httponly']) ? $this->options['httponly'] : true
$this->options['secure'],
$this->options['httponly']
)
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be kept on one line

}
Expand Down
0