Skip to content

Commit

Permalink
Added cookie enhancements for more security
Browse files Browse the repository at this point in the history
The CASAuth cookie will, by default, be more secure now.
  • Loading branch information
subfission authored Sep 29, 2016
1 parent b38f7a5 commit ea7f738
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Subfission/Cas/CasManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ public function __construct(array $config)
phpCAS::setVerbose($this->config['cas_verbose_errors']);

session_name($this->config['cas_session_name']);

// Harden session cookie to prevent some attacks on the cookie (e.g. XSS)
session_set_cookie_params($this->config['cas_session_lifetime'],
$this->config['cas_session_path'],
env('APP_DOMAIN'),
env('HTTPS_ONLY_COOKIES'),
true);

$this->configureCas($this->config['cas_proxy'] ? 'proxy' : 'client');

Expand Down Expand Up @@ -72,6 +79,8 @@ protected function parseConfig(array $config)
$defaults = [
'cas_hostname' => '',
'cas_session_name' => 'CASAuth',
'cas_session_lifetime'=> 7200,
'cas_session_path' => '/'
'cas_control_session' => false,
'cas_port' => 443,
'cas_uri' => '/cas',
Expand Down

0 comments on commit ea7f738

Please sign in to comment.