diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-08-18 14:58:03 +0300 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2017-08-18 14:58:03 +0300 |
commit | 940bcd30a31771461e6fd14318f3cbb8f79ff362 (patch) | |
tree | c093a008a8497b5babf7ab4bafce6ff9787dbe63 /lib/Controller/SAMLController.php | |
parent | 6466e71c637fa3093325a1320e81750109e08207 (diff) |
Redirect users to previous page
This change ensures that users will be sent to the previous page.
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'lib/Controller/SAMLController.php')
-rw-r--r-- | lib/Controller/SAMLController.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Controller/SAMLController.php b/lib/Controller/SAMLController.php index 9c899756..3cadb62b 100644 --- a/lib/Controller/SAMLController.php +++ b/lib/Controller/SAMLController.php @@ -135,6 +135,7 @@ class SAMLController extends Controller { $auth = new \OneLogin_Saml2_Auth($this->SAMLSettings->getOneLoginSettingsArray()); $ssoUrl = $auth->login(null, [], false, false, true); $this->session->set('user_saml.AuthNRequestID', $auth->getLastRequestID()); + $this->session->set('user_saml.OriginalUrl', $this->request->getParam('originalUrl', '')); break; case 'environment-variable': $ssoUrl = $this->urlGenerator->getAbsoluteURL('/'); @@ -232,7 +233,13 @@ class SAMLController extends Controller { return new Http\RedirectResponse($this->urlGenerator->linkToRouteAbsolute('user_saml.SAML.notProvisioned')); } - $response = new Http\RedirectResponse(\OC::$server->getURLGenerator()->getAbsoluteURL('/')); + $originalUrl = $this->session->get('user_saml.OriginalUrl'); + if($originalUrl !== null && $originalUrl !== '') { + $response = new Http\RedirectResponse($originalUrl); + } else { + $response = new Http\RedirectResponse(\OC::$server->getURLGenerator()->getAbsoluteURL('/')); + } + $this->session->remove('user_saml.OriginalUrl'); // The Nextcloud desktop client expects a cookie with the key of "_shibsession" // to be there. if($this->request->isUserAgent(['/^.*(mirall|csyncoC)\/.*$/'])) { |