code cleanup - remove special case for webdav in handleApacheAuth()
This commit is contained in:
parent
493e948146
commit
4cecede13d
21
lib/base.php
21
lib/base.php
|
@ -756,14 +756,17 @@ class OC {
|
||||||
protected static function handleLogin() {
|
protected static function handleLogin() {
|
||||||
OC_App::loadApps(array('prelogin'));
|
OC_App::loadApps(array('prelogin'));
|
||||||
$error = array();
|
$error = array();
|
||||||
if (OC::tryApacheAuth()) {
|
|
||||||
|
|
||||||
|
// auth possible via apache module?
|
||||||
|
if (OC::tryApacheAuth()) {
|
||||||
|
$error[] = 'apacheauthfailed';
|
||||||
}
|
}
|
||||||
// remember was checked after last login
|
// remember was checked after last login
|
||||||
elseif (OC::tryRememberLogin()) {
|
elseif (OC::tryRememberLogin()) {
|
||||||
$error[] = 'invalidcookie';
|
$error[] = 'invalidcookie';
|
||||||
// Someone wants to log in :
|
}
|
||||||
} elseif (OC::tryFormLogin()) {
|
// Someone wants to log in :
|
||||||
|
elseif (OC::tryFormLogin()) {
|
||||||
$error[] = 'invalidpassword';
|
$error[] = 'invalidpassword';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,7 +785,17 @@ class OC {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function tryApacheAuth() {
|
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() {
|
protected static function tryRememberLogin() {
|
||||||
|
|
|
@ -72,7 +72,8 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function authenticate(Sabre_DAV_Server $server, $realm) {
|
public function authenticate(Sabre_DAV_Server $server, $realm) {
|
||||||
if (OC_User::handleApacheAuth(true)) {
|
|
||||||
|
if (OC_User::handleApacheAuth()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,12 +237,10 @@ class OC_User {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Verify with Apache whether user is authenticated.
|
* @brief Verify with Apache whether user is authenticated.
|
||||||
* @note Currently supports only Shibboleth.
|
|
||||||
*
|
*
|
||||||
* @param $isWebdav Is this request done using webdav.
|
* @return boolean|null true: authenticated - false: not authenticated
|
||||||
* @return true: authenticated - false: not authenticated
|
|
||||||
*/
|
*/
|
||||||
public static function handleApacheAuth($isWebdav = false) {
|
public static function handleApacheAuth() {
|
||||||
foreach (self::$_usedBackends as $backend) {
|
foreach (self::$_usedBackends as $backend) {
|
||||||
if ($backend instanceof OCP\ApacheBackend) {
|
if ($backend instanceof OCP\ApacheBackend) {
|
||||||
if ($backend->isSessionActive()) {
|
if ($backend->isSessionActive()) {
|
||||||
|
@ -252,21 +250,12 @@ class OC_User {
|
||||||
self::setupBackends();
|
self::setupBackends();
|
||||||
self::unsetMagicInCookie();
|
self::unsetMagicInCookie();
|
||||||
|
|
||||||
if (self::loginWithApache($backend)) {
|
return self::loginWithApache($backend);
|
||||||
if (! $isWebdav) {
|
|
||||||
$_REQUEST['redirect_url'] = \OC_Request::requestUri();
|
|
||||||
OC_Util::redirectToDefaultPage();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue