Auth\Cas: fix handling fake_authenticated_user
This commit is contained in:
parent
02b0bbcfad
commit
40fc2f8c75
1 changed files with 14 additions and 9 deletions
|
@ -81,16 +81,21 @@ class Cas extends Method {
|
|||
* @return \EesyPHP\Auth\User|null
|
||||
*/
|
||||
public static function login($force=false) {
|
||||
if (!phpCAS :: isAuthenticated() && $force) {
|
||||
$_SESSION['cas_callback_url'] = self :: get_cas_callback_url();
|
||||
phpCAS :: setFixedServiceURL($_SESSION['cas_callback_url']);
|
||||
phpCAS :: forceAuthentication();
|
||||
if (self :: $fake_authenticated_user) {
|
||||
$user = Auth :: get_user(self :: $fake_authenticated_user);
|
||||
}
|
||||
else {
|
||||
if (!phpCAS :: isAuthenticated() && $force) {
|
||||
$_SESSION['cas_callback_url'] = self :: get_cas_callback_url();
|
||||
phpCAS :: setFixedServiceURL($_SESSION['cas_callback_url']);
|
||||
phpCAS :: forceAuthentication();
|
||||
}
|
||||
$user = (
|
||||
phpCAS :: isAuthenticated()?
|
||||
Auth :: get_user(phpCAS :: getUser()):
|
||||
null
|
||||
);
|
||||
}
|
||||
$user = (
|
||||
phpCAS :: isAuthenticated()?
|
||||
Auth :: get_user(phpCAS :: getUser()):
|
||||
null
|
||||
);
|
||||
if ($force && !$user)
|
||||
Log :: fatal('Fail to authenticate you');
|
||||
return $user;
|
||||
|
|
Loading…
Reference in a new issue