public function __construct()
 {
     $this->request = \OC::$server->getRequest();
     $this->config = \OC::$server->getSystemConfig();
     $this->redirectUrl = $this->request->getRequestUri();
     $this->defaultPageUrl = \OC_Util::getDefaultPageUrl();
     $this->visitPort = (int) $_SERVER["SERVER_PORT"];
     if ($this->config->getValue("sso_multiple_region")) {
         array_push(self::$requiredKeys, "sso_owncloud_url");
         array_push(self::$requiredKeys, "sso_regions");
     }
     foreach ($this->necessaryImplementationClass as $class) {
         if (!class_exists($class)) {
             throw new Exception("The class " . $class . " did't exist.");
         }
     }
     self::checkKeyExist(self::$requiredKeys);
     RequestManager::init($this->config->getValue("sso_portal_url"), $this->config->getValue("sso_requests"));
 }
示例#2
0
 public static function webDavLogin($userID, $password)
 {
     $config = \OC::$server->getSystemConfig();
     RequestManager::init($config->getValue("sso_portal_url"), $config->getValue("sso_requests"));
     $authInfo = WebDavAuthInfo::get($userID, $password);
     $userInfo = RequestManager::getRequest(ISingleSignOnRequest::INFO);
     $userInfo->setup(array("action" => "webDavLogin"));
     if (!$userInfo->send($authInfo)) {
         return;
     }
     if ($config->getValue("sso_multiple_region")) {
         self::redirectRegion($userInfo, $config->getValue("sso_regions"), $config->getValue("sso_owncloud_url"));
     }
     if (!\OC_User::userExists($userInfo->getUserId())) {
         return self::firstLogin($userInfo, $authInfo);
     }
     if ($authInfo) {
         return self::login($userInfo, $authInfo);
     }
     return false;
 }