Skip to content

Commit c77f22d

Browse files
Merge pull request #228 from nextcloud/backport/199/stable2.7
[stable2.7] fix(oidc): state might be used in session keys
2 parents 1ea98c5 + 67ff722 commit c77f22d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/Master.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ public function handleLoginRequest(
139139
'providerId' => $this->session->get(\OCA\UserOIDC\Controller\LoginController::PROVIDERID)
140140
];
141141
// TODO: switch 'oidc.redirect' to \OCA\UserOIDC\Controller\LoginController::REDIRECT_AFTER_LOGIN once switched to public
142-
$options['target'] = $this->forceRelativeUrl($this->session->get('oidc.redirect') ?? '/');
142+
$state = $this->request->getParam('state') ?? '';
143+
$sessionKeySuffix = ($state !== '') ? '-' . $state : '';
144+
$redirect = $this->session->get('oidc.redirect') ?? $this->session->get('oidc.redirect' . $sessionKeySuffix) ?? '/';
145+
$options['target'] = $this->forceRelativeUrl($redirect);
143146

144147
// Fix: restore the slave flow path into options.target after all backend blocks.
145148
//

0 commit comments

Comments
 (0)