19 declare(strict_types=1);
37 $this->
logger = $DIC->logger()->auth();
39 $this->
lng = $DIC->language();
40 $this->
lng->loadLanguageModule(
'auth');
50 $this->
logger->debug(
'Logging out with token: ' . $id_token);
52 if (isset($id_token) && $id_token !==
'') {
60 }
catch (\Jumbojett\OpenIDConnectClientException
$e) {
61 $this->
logger->warning(
'Logging out of OIDC provider failed with: ' . $e->getMessage());
70 $oidc->setRedirectURL(ILIAS_HTTP_PATH .
'/openidconnect.php');
73 if ($proxy->isActive()) {
74 $host = $proxy->getHost();
75 $port = $proxy->getPort();
79 $oidc->setHttpProxy($host);
84 $oidc->getRedirectURL()
87 $oidc->addScope($this->
settings->getAllScopes());
89 $oidc->addAuthParam([
'prompt' =>
'login']);
92 $oidc->authenticate();
95 $claims = $oidc->getVerifiedClaims();
107 $this->
logger->warning($e->getMessage());
108 $this->
logger->warning((
string) $e->getCode());
120 if (!is_object($user_info)) {
121 $this->
logger->error(
'Received invalid user credentials: ');
128 $uid_field = $this->
settings->getUidField();
129 $ext_account = $user_info->{$uid_field} ??
'';
131 if (!is_string($ext_account) || $ext_account ===
'') {
132 $this->
logger->error(
'Could not determine valid external account, value is empty or not a string.');
135 $status->setReason(
'err_wrong_login');
139 $this->
logger->debug(
'Authenticated external account: ' . $ext_account);
148 $sync->setExternalAccount($ext_account);
149 $sync->setInternalAccount((
string) $int_account);
159 $status->setReason(
'err_wrong_login');
167 $oidc =
new OpenIDConnectClient(
173 $oidc->setCodeChallengeMethod(
'S256');
const AUTH_OPENID_CONNECT
static get(string $a_var)
doAuthentication(ilAuthStatus $status)
const LOGOUT_SCOPE_GLOBAL
Interface of auth credentials.
const STATUS_AUTHENTICATION_FAILED
static _checkExternalAuthAccount(string $a_auth, string $a_account, bool $tryFallback=true)
check whether external account and authentication method matches with a user
readonly ilLogger $logger
Base class for authentication providers (ldap, apache, ...)
static logoutUrl(array $parameters=[])
Return the logout URL with a valid CSRF token.
setStatus(int $a_status)
Set auth status.
ilAuthCredentials $credentials
readonly ilOpenIdConnectSettings $settings
const STATUS_AUTHENTICATED
__construct(Container $dic, ilPlugin $plugin)
handleUpdate(ilAuthStatus $status, $user_info)
setTranslatedReason(string $a_reason)
Set translated reason.
setReason(string $a_reason)
Set reason.
Auth status implementation.
__construct(ilAuthCredentials $credentials)
static set(string $a_var, $a_val)
Set a value.