Skip to content

Commit c410e3e

Browse files
committed
fix: get the prompt config value in a safer way
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
1 parent 0b23813 commit c410e3e

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

lib/Controller/LoginController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public function login(int $providerId, ?string $redirectUrl = null) {
272272
'nonce' => $nonce,
273273
];
274274

275-
if ($oidcConfig['prompt']) {
275+
if (isset($oidcConfig['prompt']) && is_string($oidcConfig['prompt'])) {
276276
$data['prompt'] = $oidcConfig['prompt'];
277277
}
278278

lib/Service/TokenService.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,10 @@ public function getExchangedToken(string $targetAudience, array $extraScopes = [
269269
'audience' => $targetAudience,
270270
'scope' => $scope,
271271
];
272-
if ($this->config->getSystemValue('user_oidc.prompt') !== '') {
272+
$oidcConfig = $this->config->getSystemValue('user_oidc', []);
273+
if (isset($oidcConfig['prompt']) && is_string($oidcConfig['prompt'])) {
273274
// none, consent, login and internal for oauth2 passport server
274-
$tokenEndpointParams['prompt'] = $this->config->getSystemValue('user_oidc.prompt');
275+
$tokenEndpointParams['prompt'] = $oidcConfig['prompt'];
275276
}
276277
// more in https://www.keycloak.org/securing-apps/token-exchange
277278
$body = $this->clientService->post(

0 commit comments

Comments
 (0)