be able to call cron locally/remotely via any authentication mode that implements iTokenLoginUIExtension (interface badly named)

This commit is contained in:
odain
2026-02-09 23:08:48 +01:00
parent d92bdf7b89
commit a7ebf30746
12 changed files with 158 additions and 64 deletions

View File

@@ -9,7 +9,7 @@ use Combodo\iTop\Application\Helper\Session;
* @license http://opensource.org/licenses/AGPL-3.0
*/
class LoginBasic extends AbstractLoginFSMExtension
class LoginBasic extends AbstractLoginFSMExtension implements iTokenLoginUIExtension
{
/**
* Return the list of supported login modes for this plugin
@@ -120,4 +120,21 @@ class LoginBasic extends AbstractLoginFSMExtension
}
return [$sAuthUser, $sAuthPwd];
}
public function GetTokenInfo(): array
{
return $this->GetAuthUserAndPassword();
}
public function GetUserLogin(array $aTokenInfo): string
{
$sLogin = $aTokenInfo[0];
$sLoginMode = 'basic';
if (UserRights::CheckCredentials($sLogin, $aTokenInfo[1], $sLoginMode, 'internal'))
{
return $sLogin;
}
throw new Exception("Cannot CheckCredentials user login ($sLogin) with ($sLoginMode) mode");
}
}