Skip to content

Commit 02eebfa

Browse files
committed
make sure the user_oidc login does not redirect to logout (when allow_multiple_user_backends == 0)
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
1 parent 2c503b3 commit 02eebfa

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/AppInfo/Application.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ private function registerRedirect(IRequest $request, IURLGenerator $urlGenerator
9797
// in case any errors happen when checking for the path do not apply redirect logic as it is only needed for the login
9898
}
9999
if ($isDefaultLogin && !$settings->getAllowMultipleUserBackEnds() && count($providers) === 1) {
100+
// To avoid login/logout loop if the IdP session is still alive:
101+
// if the login page's redirect_url GET param is the logout page, just use the base URL instead
102+
$logoutUrl = $urlGenerator->linkToRoute('core.login.logout');
103+
if (strpos($redirectUrl, $logoutUrl) !== false) {
104+
$redirectUrl = $urlGenerator->getBaseUrl();
105+
}
100106
$targetUrl = $urlGenerator->linkToRoute(self::APP_ID . '.login.login', [
101107
'providerId' => $providers[0]->getId(),
102108
'redirectUrl' => $redirectUrl

0 commit comments

Comments
 (0)