Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ class ilAuthFrontendCredentialsOpenIdConnect extends ilAuthFrontendCredentials
{
private const SESSION_TARGET = 'oidc_target';
private const QUERY_PARAM_TARGET = 'target';
private const QUERY_PARAM_REGISTER = 'register';

private readonly ilOpenIdConnectSettings $settings;
private ?string $target = null;
private bool $registration_requested = false;

public function __construct()
{
Expand All @@ -37,6 +39,12 @@ public function __construct()
if ($httpquery->has(self::QUERY_PARAM_TARGET)) {
$this->target = $httpquery->retrieve(self::QUERY_PARAM_TARGET, $DIC->refinery()->to()->string());
}
if ($httpquery->has(self::QUERY_PARAM_REGISTER)) {
$this->registration_requested = $httpquery->retrieve(
self::QUERY_PARAM_REGISTER,
$DIC->refinery()->kindlyTo()->bool()
);
}
}

protected function getSettings(): ilOpenIdConnectSettings
Expand All @@ -49,6 +57,11 @@ public function getRedirectionTarget(): ?string
return $this->target;
}

public function isRegistrationRequested(): bool
{
return $this->registration_requested;
}

public function initFromRequest(): void
{
$this->setUsername('');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,14 @@ public function doAuthentication(ilAuthStatus $status): bool
);

$oidc->addScope($this->settings->getAllScopes());
if ($this->settings->getLoginPromptType() === ilOpenIdConnectSettings::LOGIN_ENFORCE) {

$credentials = $this->getCredentials();
if (
$credentials instanceof ilAuthFrontendCredentialsOpenIdConnect &&
$credentials->isRegistrationRequested()
) {
$oidc->addAuthParam(['prompt' => 'create']);
} elseif ($this->settings->getLoginPromptType() === ilOpenIdConnectSettings::LOGIN_ENFORCE) {
$oidc->addAuthParam(['prompt' => 'login']);
}

Expand Down