public function __construct()
 {
     $this->sspPath = OCP\Config::getAppValue('user_saml', 'saml_ssp_path', '');
     $this->spSource = OCP\Config::getAppValue('user_saml', 'saml_sp_source', '');
     $this->forceLogin = OCP\Config::getAppValue('user_saml', 'saml_force_saml_login', false);
     $this->autocreate = OCP\Config::getAppValue('user_saml', 'saml_autocreate', false);
     $this->updateUserData = OCP\Config::getAppValue('user_saml', 'saml_update_user_data', false);
     $this->defaultGroup = OCP\Config::getAppValue('user_saml', 'saml_default_group', '');
     $this->protectedGroups = explode(',', preg_replace('/\\s+/', '', OCP\Config::getAppValue('user_saml', 'saml_protected_groups', '')));
     $this->usernameMapping = explode(',', preg_replace('/\\s+/', '', OCP\Config::getAppValue('user_saml', 'saml_username_mapping', '')));
     $this->mailMapping = explode(',', preg_replace('/\\s+/', '', OCP\Config::getAppValue('user_saml', 'saml_email_mapping', '')));
     $this->displayNameMapping = explode(',', preg_replace('/\\s+/', '', OCP\Config::getAppValue('user_saml', 'saml_displayname_mapping', '')));
     $this->quotaMapping = explode(',', preg_replace('/\\s+/', '', OCP\Config::getAppValue('user_saml', 'saml_quota_mapping', '')));
     $this->defaultQuota = OCP\Config::getAppValue('user_saml', 'saml_default_quota', '');
     $this->groupMapping = explode(',', preg_replace('/\\s+/', '', OCP\Config::getAppValue('user_saml', 'saml_group_mapping', '')));
     if (!empty($this->sspPath) && !empty($this->spSource)) {
         include_once $this->sspPath . "/lib/_autoload.php";
         $this->auth = new SimpleSAML_Auth_Simple($this->spSource);
         if (isset($_COOKIE["user_saml_logged_in"]) and $_COOKIE["user_saml_logged_in"] and !$this->auth->isAuthenticated()) {
             unset($_COOKIE["user_saml_logged_in"]);
             setcookie("user_saml_logged_in", null, -1);
             OCP\User::logout();
         }
     }
 }
示例#2
0
文件: app.php 项目: hjimmy/owncloud
    OC_FileProxy::register(new OCA\Encryption\Proxy());
    // User related hooks
    OCA\Encryption\Helper::registerUserHooks();
    // Sharing related hooks
    OCA\Encryption\Helper::registerShareHooks();
    // Filesystem related hooks
    OCA\Encryption\Helper::registerFilesystemHooks();
    // App manager related hooks
    OCA\Encryption\Helper::registerAppHooks();
    if (!in_array('crypt', stream_get_wrappers())) {
        stream_wrapper_register('crypt', 'OCA\\Encryption\\Stream');
    }
    // check if we are logged in
    if (OCP\User::isLoggedIn()) {
        // ensure filesystem is loaded
        if (!\OC\Files\Filesystem::$loaded) {
            \OC_Util::setupFS();
        }
        $view = new OC_FilesystemView('/');
        $sessionReady = OCA\Encryption\Helper::checkRequirements();
        if ($sessionReady) {
            $session = new \OCA\Encryption\Session($view);
        }
    }
} else {
    // logout user if we are in maintenance to force re-login
    OCP\User::logout();
}
// Register settings scripts
OCP\App::registerAdmin('files_encryption', 'settings-admin');
OCP\App::registerPersonal('files_encryption', 'settings-personal');