Skip to content

Commit

Permalink
make sure the user_oidc login does not redirect to logout (when allow…
Browse files Browse the repository at this point in the history
…_multiple_user_backends == 0)

Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed Jan 16, 2024
1 parent 4db5bc0 commit bba1392
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ private function registerRedirect(IRequest $request, IURLGenerator $urlGenerator
// in case any errors happen when checking for the path do not apply redirect logic as it is only needed for the login
}
if ($isDefaultLogin && !$settings->getAllowMultipleUserBackEnds() && count($providers) === 1) {
// To avoid login/logout loop if the IdP session is still alive:
// if the login page's redirect_url GET param is the logout page, just use the base URL instead
$logoutUrl = $urlGenerator->linkToRoute('core.login.logout');
if (strpos($redirectUrl, $logoutUrl) !== false) {
$redirectUrl = $urlGenerator->getBaseUrl();
}
$targetUrl = $urlGenerator->linkToRoute(self::APP_ID . '.login.login', [
'providerId' => $providers[0]->getId(),
'redirectUrl' => $redirectUrl
Expand Down

0 comments on commit bba1392

Please sign in to comment.