예제 #1
0
파일: hooks.php 프로젝트: AARNet/user_saml
 private static function user_redirect($userid)
 {
     if (!OCP\App::isEnabled('files_sharding')) {
         return;
     }
     $redirect = OCA\FilesSharding\Lib::getServerForUser($userid);
     if (self::check_user("", "", $userid) && !empty($redirect)) {
         if (!empty($redirect)) {
             $parsedRedirect = parse_url($redirect);
             if ($_SERVER['HTTP_HOST'] !== $parsedRedirect['host']) {
                 $redirect_full = preg_replace("/(\\?*)app=user_saml(\\&*)/", "\$1", $redirect . $_SERVER['REQUEST_URI']);
                 OC_Log::write('saml', 'Redirecting to: ' . $redirect_full, OC_Log::WARN);
                 header("HTTP/1.1 301 Moved Permanently");
                 header('Location: ' . $redirect_full);
                 exit;
             }
         }
     }
 }
예제 #2
0
파일: app.php 프로젝트: AARNet/user_saml
                $path .= '&' . urldecode($_GET["linktoargs"]);
            }
            header('Location: ' . $path);
            exit;
        }
        OC::$REQUESTEDAPP = '';
        OC_Util::redirectToDefaultPage();
    }
    // We load the login prompt only if we're stand-alone or on the sharding master
    if (!OCP\User::isLoggedIn() && (!OCP\App::isEnabled('files_sharding') || \OCA\FilesSharding\Lib::isMaster())) {
        // Load js code in order to render the SAML link and to hide parts of the normal login form
        OCP\Util::addScript('user_saml', 'utils');
    }
    if (OCP\App::isEnabled('files_sharding') && OCP\User::isLoggedIn() && strlen($_SERVER['REQUEST_URI']) > 1 && strpos($_SERVER['REQUEST_URI'], '/index.php/settings') === FALSE && strpos($_SERVER['REQUEST_URI'], 'logout') === FALSE && strpos($_SERVER['REQUEST_URI'], '/ajax/') === FALSE && strpos($_SERVER['REQUEST_URI'], '/jqueryFileTree.php') === FALSE && strpos($_SERVER['REQUEST_URI'], '/ws/') === FALSE) {
        $userid = \OCP\User::getUser();
        $redirect = OCA\FilesSharding\Lib::getServerForUser($userid);
        if (!empty($redirect)) {
            $parsedRedirect = parse_url($redirect);
            if ($_SERVER['HTTP_HOST'] !== $parsedRedirect['host']) {
                $redirect_full = preg_replace("/(\\?*)app=user_saml(\\&*)/", "\$1", $redirect . $_SERVER['REQUEST_URI']);
                OC_USER_SAML_Hooks::setRedirectCookie();
                OC_Log::write('user_saml', 'Redirecting to ' . $redirect_full, OC_Log::WARN);
                header("HTTP/1.1 301 Moved Permanently");
                header('Location: ' . $redirect_full);
                exit;
            }
        }
    }
}
/*
 * Checks if requiring SAML authentication on current URL makes sense when