Skip to content

Commit fa02ef8

Browse files
committed
2571: Make endSessionUrl nullable
1 parent c33654d commit fa02ef8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Controller/AuthOidcController.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,23 @@ public function getUrls(Request $request, SessionInterface $session): Response
7272
$session->set('oauth2state', $state);
7373
$session->set('oauth2nonce', $nonce);
7474

75+
76+
// We allow end session endpoint to not be set, by letting $endSessionUrl be null.
77+
// This is handled in the admin by removing the logout button.
78+
try {
79+
$endSessionUrl = $provider->getEndSessionUrl();
80+
} catch (ItkOpenIdConnectException $e) {
81+
$endSessionUrl = null;
82+
}
83+
7584
$data = [
7685
'authorizationUrl' => $provider->getAuthorizationUrl([
7786
'state' => $state,
7887
'nonce' => $nonce,
7988
'response_type' => 'code',
8089
'scope' => 'openid email profile',
8190
]),
82-
'endSessionUrl' => $provider->getEndSessionUrl(),
91+
'endSessionUrl' => $endSessionUrl,
8392
];
8493

8594
return new JsonResponse($data);

0 commit comments

Comments
 (0)