diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-06-30 01:31:11 +0300 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2016-06-30 01:31:11 +0300 |
commit | 1abff7050e307755b6c28d26fa5136669a5e57fa (patch) | |
tree | cd52739fdd079091ebb6acd1cf61e75a11d6002d /appinfo | |
parent | b9a157e36de2b48da31947c1f9fd000bc923f757 (diff) |
Add workaround for stable9 non-stable entry URL
Diffstat (limited to 'appinfo')
-rw-r--r-- | appinfo/app.php | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/appinfo/app.php b/appinfo/app.php index 9265c332..2768594f 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -50,19 +50,17 @@ try { return; } -// Redirect all requests to the login page to the SAML login // Since with Nextcloud 9 we don't have an unique entry point this is a little -// bit hacky and won't necessarily detect all situations. -$currentUrl = substr(explode('?',$request->getRequestUri(), 2)[0], strlen(\OC::$WEBROOT)); -if(($currentUrl === '/index.php') && !OC_User::isLoggedIn()) { - $csrfToken = \OC::$server->getCsrfTokenManager()->getToken(); - header('Location: '.$urlGenerator->linkToRouteAbsolute('user_saml.SAML.login') .'?requesttoken='. urlencode($csrfToken->getEncryptedValue())); - exit(); +// bit hacky and won't necessarily detect all situations. So we inject some magic +// Javascript that does the work for us. +if(!OC_User::isLoggedIn()) { + \OCP\Util::addHeader('script', ['src' => $urlGenerator->linkTo('user_saml', 'js/preauth.js')], ''); } // If a request to OCS or remote.php is sent by the official desktop clients it can // be intercepted as it supports SAML. All other clients don't yet and thus we // require the usage of application specific passwords there. +$currentUrl = substr(explode('?',$request->getRequestUri(), 2)[0], strlen(\OC::$WEBROOT)); if(substr($currentUrl, 0, 12) === '/remote.php/' || substr($currentUrl, 0, 5) === '/ocs/') { if(!OC_User::isLoggedIn() && $request->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_OWNCLOUD_DESKTOP])) { $csrfToken = \OC::$server->getCsrfTokenManager()->getToken(); |