Skip to content

Commit

Permalink
Take auth configuration from cubex config
Browse files Browse the repository at this point in the history
  • Loading branch information
bajb committed Apr 23, 2015
1 parent d1733a4 commit 2922be6
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions src/ServiceManager/Services/AuthService.php
Expand Up @@ -80,10 +80,20 @@ protected function _setLoginCookie(IAuthedUser $user)
Cookie::make(
$this->getCookieName(),
$user->serialize(),
$this->getConfigItem('cookie_time', 2592000),
$this->getCubex()->getConfiguration()->getItem(
'auth',
'cookie_time',
2592000
),
null,
$domain,
ValueAs::bool($this->getConfigItem('cookie_secure', false))
ValueAs::bool(
$this->getCubex()->getConfiguration()->getItem(
'auth',
'cookie_secure',
false
)
)
)
);
}
Expand Down Expand Up @@ -136,7 +146,11 @@ public function isLoggedIn()
*/
public function getCookieName()
{
return $this->getConfigItem('cookie_name', 'cubex_login');
return $this->getCubex()->getConfiguration()->getItem(
'auth',
'cookie_name',
'cubex_login'
);
}

/**
Expand Down Expand Up @@ -165,7 +179,14 @@ public function getAuthedUser()
$this->_authedUser = $serviceUser;
//Set the login cookie when retrieved the user from the auth provider
//Defaulted to on for speed, but can be disabled within the config
if(ValueAs::bool($this->getConfigItem('cookie_retriever'), true))
if(ValueAs::bool(
$this->getCubex()->getConfiguration()->getItem(
'auth',
'cookie_retriever'
),
true
)
)
{
$this->_setLoginCookie($serviceUser);
}
Expand Down

0 comments on commit 2922be6

Please sign in to comment.