Auth\Cas: fix handling fake_authenticated_user

This commit is contained in:
Benjamin Renard 2023-02-27 13:06:34 +01:00
parent 02b0bbcfad
commit 40fc2f8c75

View file

@ -81,6 +81,10 @@ class Cas extends Method {
* @return \EesyPHP\Auth\User|null * @return \EesyPHP\Auth\User|null
*/ */
public static function login($force=false) { public static function login($force=false) {
if (self :: $fake_authenticated_user) {
$user = Auth :: get_user(self :: $fake_authenticated_user);
}
else {
if (!phpCAS :: isAuthenticated() && $force) { if (!phpCAS :: isAuthenticated() && $force) {
$_SESSION['cas_callback_url'] = self :: get_cas_callback_url(); $_SESSION['cas_callback_url'] = self :: get_cas_callback_url();
phpCAS :: setFixedServiceURL($_SESSION['cas_callback_url']); phpCAS :: setFixedServiceURL($_SESSION['cas_callback_url']);
@ -91,6 +95,7 @@ class Cas extends Method {
Auth :: get_user(phpCAS :: getUser()): Auth :: get_user(phpCAS :: getUser()):
null null
); );
}
if ($force && !$user) if ($force && !$user)
Log :: fatal('Fail to authenticate you'); Log :: fatal('Fail to authenticate you');
return $user; return $user;