/** * Stores the configuration. Calls the parent configuration first, * then does additional operations. * * @param object Properties $configuration * @return object * @access public * @since 3/24/05 */ function assignConfiguration(Properties $configuration) { parent::assignConfiguration($configuration); $this->_connector = new LDAPConnector($configuration); $this->_configuration->addProperty('connector', $this->_connector); // Validate the configuration options we use: ArgumentValidator::validate($this->_configuration->getProperty('properties_fields'), ArrayValidatorRuleWithRule::getRule(StringValidatorRule::getRule())); }
/** * Stores the configuration. Calls the parent configuration first, * then does additional operations. * * @param object Properties $configuration * @return object * @access public * @since 3/24/05 */ function assignConfiguration(Properties $configuration) { parent::assignConfiguration($configuration); $format = $configuration->getProperty('DISPLAY_NAME_FORMAT'); ArgumentValidator::validate($format, RegexValidatorRule::getRule('/\\[\\[([^]]+)\\]\\]/')); $this->displayNameFormat = $format; if ($debug = $configuration->getProperty('CAS_DEBUG_PATH')) { ArgumentValidator::validate($debug, StringValidatorRule::getRule()); phpCAS::setDebug($debug); } $host = $configuration->getProperty('CAS_HOST'); ArgumentValidator::validate($host, RegexValidatorRule::getRule('/^[a-z0-9]+\\.[a-z0-9]+.[a-z]+$/')); $port = $configuration->getProperty('CAS_PORT'); ArgumentValidator::validate($port, RegexValidatorRule::getRule('/^[0-9]+$/')); $path = $configuration->getProperty('CAS_PATH'); ArgumentValidator::validate($path, RegexValidatorRule::getRule('/^\\/.*$/')); phpCAS::client(CAS_VERSION_2_0, $host, intval($port), $path, false); if ($cert = $configuration->getProperty('CAS_CERT')) { phpCAS::setCasServerCACert($cert); } else { phpCAS::setNoCasServerValidation(); } // Allow group lookup via a CASDirectory: // https://mediawiki.middlebury.edu/wiki/LIS/CAS_Directory $dirUrl = $configuration->getProperty('CASDIRECTORY_BASE_URL'); ArgumentValidator::validate($dirUrl, StringValidatorRule::getRule()); $this->directoryUrl = $dirUrl; // set the callback URL for the PGT to be sent to. This must be an https url // whose certificate is trusted by CAS. // $callbackUrl = $configuration->getProperty('CALLBACK_URL'); // ArgumentValidator::validate($callbackUrl, RegexValidatorRule::getRule('/^https:\/\/.*$/')); // phpCAS::setFixedCallbackURL($callbackUrl); $adminAccess = $configuration->getProperty('CASDIRECTORY_ADMIN_ACCESS'); ArgumentValidator::validate($adminAccess, StringValidatorRule::getRule()); $this->adminAccess = $adminAccess; $classRoot = $configuration->getProperty('CASDIRECTORY_CLASS_ROOT'); if ($classRoot) { ArgumentValidator::validate($classRoot, StringValidatorRule::getRule()); $this->classRoot = $classRoot; } else { $this->classRoot = null; } $groupIdRegex = $configuration->getProperty('CASDIRECTORY_GROUP_ID_REGEX'); if ($groupIdRegex) { ArgumentValidator::validate($groupIdRegex, StringValidatorRule::getRule()); $this->groupIdRegex = $groupIdRegex; } else { $this->groupIdRegex = null; } // Root Groups to expose ArgumentValidator::validate($configuration->getProperty('ROOT_GROUPS'), ArrayValidatorRuleWithRule::getRule(StringValidatorRule::getRule())); $this->rootGroups = array_unique($configuration->getProperty('ROOT_GROUPS')); }
/** * Stores the configuration. Calls the parent configuration first, * then does additional operations. * * @param object Properties $configuration * @return object * @access public * @since 3/24/05 */ function assignConfiguration(Properties $configuration) { parent::assignConfiguration($configuration); // Validate the configuration options we use: ArgumentValidator::validate($this->_configuration->getProperty('properties_fields'), ArrayValidatorRuleWithRule::getRule(StringValidatorRule::getRule())); ArgumentValidator::validate($this->_configuration->getProperty('database_id'), IntegerValidatorRule::getRule()); ArgumentValidator::validate($this->_configuration->getProperty('authentication_table'), StringValidatorRule::getRule()); ArgumentValidator::validate($this->_configuration->getProperty('username_field'), StringValidatorRule::getRule()); ArgumentValidator::validate($this->_configuration->getProperty('password_field'), StringValidatorRule::getRule()); ArgumentValidator::validate($this->_configuration->getProperty('allow_token_addition'), OptionalRule::getRule(BooleanValidatorRule::getRule())); ArgumentValidator::validate($this->_configuration->getProperty('allow_token_deletion'), OptionalRule::getRule(BooleanValidatorRule::getRule())); ArgumentValidator::validate($this->_configuration->getProperty('allow_token_updates'), OptionalRule::getRule(BooleanValidatorRule::getRule())); ArgumentValidator::validate($this->_configuration->getProperty('allow_property_updates'), OptionalRule::getRule(BooleanValidatorRule::getRule())); }