protected static function handleLogin() {
OC_App::loadApps(array('prelogin'));
$error = array();
- if (OC::tryApacheAuth()) {
+ // auth possible via apache module?
+ if (OC::tryApacheAuth()) {
+ $error[] = 'apacheauthfailed';
}
// remember was checked after last login
elseif (OC::tryRememberLogin()) {
$error[] = 'invalidcookie';
- // Someone wants to log in :
- } elseif (OC::tryFormLogin()) {
+ }
+ // Someone wants to log in :
+ elseif (OC::tryFormLogin()) {
$error[] = 'invalidpassword';
}
}
protected static function tryApacheAuth() {
- return OC_User::handleApacheAuth(false);
+ $return = OC_User::handleApacheAuth();
+
+ // if return is true we are logged in -> redirect to the default page
+ if ($return === true) {
+ $_REQUEST['redirect_url'] = \OC_Request::requestUri();
+ OC_Util::redirectToDefaultPage();
+ exit;
+ }
+
+ // in case $return is null apache based auth is not enabled
+ return is_null($return) ? false : true;
}
protected static function tryRememberLogin() {
/**
* @brief Verify with Apache whether user is authenticated.
- * @note Currently supports only Shibboleth.
*
- * @param $isWebdav Is this request done using webdav.
- * @return true: authenticated - false: not authenticated
+ * @return boolean|null true: authenticated - false: not authenticated
*/
- public static function handleApacheAuth($isWebdav = false) {
+ public static function handleApacheAuth() {
foreach (self::$_usedBackends as $backend) {
if ($backend instanceof OCP\ApacheBackend) {
if ($backend->isSessionActive()) {
self::setupBackends();
self::unsetMagicInCookie();
- if (self::loginWithApache($backend)) {
- if (! $isWebdav) {
- $_REQUEST['redirect_url'] = \OC_Request::requestUri();
- OC_Util::redirectToDefaultPage();
- return true;
- }
- else {
- return true;
- }
- }
+ return self::loginWithApache($backend);
}
}
}
- return false;
+ return null;
}