public function __construct()
{
// These are default values for the first login and should be changed via GUI
$CAS_HOSTNAME = 'your.domain.org';
$CAS_PORT = '443';
$CAS_PATH = '/cas';
$this->autocreate = OCP\Config::getAppValue('user_cas', 'cas_autocreate', true);
$this->updateUserData = OCP\Config::getAppValue('user_cas', 'cas_update_user_data', true);
$this->defaultGroup = OCP\Config::getAppValue('user_cas', 'cas_default_group', '');
$this->protectedGroups = explode(',', str_replace(' ', '', OCP\Config::getAppValue('user_cas', 'cas_protected_groups', '')));
$this->mailMapping = OCP\Config::getAppValue('user_cas', 'cas_email_mapping', '');
$this->displayNameMapping = OCP\Config::getAppValue('user_cas', 'cas_displayName_mapping', '');
$this->groupMapping = OCP\Config::getAppValue('user_cas', 'cas_group_mapping', '');
$casVersion = OCP\Config::getAppValue('user_cas', 'cas_server_version', '2.0');
$casHostname = OCP\Config::getAppValue('user_cas', 'cas_server_hostname', $CAS_HOSTNAME);
$casPort = OCP\Config::getAppValue('user_cas', 'cas_server_port', $CAS_PORT);
$casPath = OCP\Config::getAppValue('user_cas', 'cas_server_path', $CAS_PATH);
$casCertPath = OCP\Config::getAppValue('user_cas', 'cas_cert_path', '');
global $initialized_cas;
if (!$initialized_cas) {
phpCAS::client($casVersion, $casHostname, (int) $casPort, $casPath, false);
if (!empty($casCertPath)) {
phpCAS::setCasServerCACert($casCertPath);
} else {
phpCAS::setNoCasServerValidation();
}
$initialized_cas = true;
}
}