/** * Initialize this filter * * @param array $config The configuration information about this filter * @param mixed $reserved For future use * * @throws SimpleSAML_Error_Exception * @since Release 1.0.0 */ public function __construct($config, $reserved) { assert('is_array($config)'); // Call parent constructor parent::__construct($config, $reserved); // Process config array foreach ($config as $name => $value) { if (!is_string($name)) { throw new SimpleSAML_Error_Exception('Config parameter must be string in janus:AccessBlocker: ' . var_export($name, true)); } // If parameter is `blocked` if ($name === 'blocked') { if (!is_array($value) && is_string($value)) { $this->_blocked = array($value); } else { $this->_blocked = $value; } } else { if ($name === 'allowed') { if (!is_array($value) && is_string($value)) { $this->_allowed = array($value); } else { $this->_allowed = $value; } } else { new SimpleSAML_Error_Exception('Invalid config parameter given to janus:AccessBlocker: ' . var_export($name, true)); } } } }
/** * Initialize the filter. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); if (array_key_exists('enforce_2fa', $config)) { $this->enforce_2fa = $config['enforce_2fa']; if (!is_bool($this->enforce_2fa)) { throw new Exception('Invalid attribute name given to simpletotp::2fa filter: enforce_2fa must be a boolean.'); } } if (array_key_exists('secret_attr', $config)) { $this->secret_attr = $config['secret_attr']; if (!is_string($this->secret_attr)) { throw new Exception('Invalid attribute name given to simpletotp::2fa filter: secret_attr must be a string'); } } if (array_key_exists('not_configured_url', $config)) { $this->not_configured_url = $config['not_configured_url']; if (!is_string($config['not_configured_url'])) { throw new Exception('Invalid attribute value given to simpletotp::2fa filter: not_configured_url must be a string'); } //validate URL to ensure it's we will be able to redirect to $this->not_configured_url = SimpleSAML_Utilities::checkURLAllowed($config['not_configured_url']); } }
/** * Initialize this filter. * Validate configuration parameters. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); // Check for the deny option, get it and remove it // Must be bool specifically, if not, it might be for a attrib filter below if (isset($config['deny']) && is_bool($config['deny'])) { $this->deny = $config['deny']; unset($config['deny']); } // Check for the regex option, get it and remove it // Must be bool specifically, if not, it might be for a attrib filter below if (isset($config['regex']) && is_bool($config['regex'])) { $this->regex = $config['regex']; unset($config['regex']); } foreach ($config as $attribute => $values) { if (is_string($values)) { $values = array($values); } if (!is_array($values)) { throw new Exception('Filter Authorize: Attribute values is neither string nor array: ' . var_export($attribute, TRUE)); } foreach ($values as $value) { if (!is_string($value)) { throw new Exception('Filter Authorize: Each value should be a string for attribute: ' . var_export($attribute, TRUE) . ' value: ' . var_export($value, TRUE) . ' Config is: ' . var_export($config, TRUE)); } } $this->valid_attribute_values[$attribute] = $values; } }
/** * Initialize this filter. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); foreach ($config as $name => $value) { // Is %replace set? if (is_int($name)) { if ($value == '%replace') { $this->replace = TRUE; } else { throw new Exception('Unknown flag : ' . var_export($value, TRUE)); } continue; } // Unknown flag if (!is_string($name)) { throw new Exception('Unknown flag : ' . var_export($name, TRUE)); } // Set pattern if ($name == 'pattern') { $this->pattern = $value; } // Set replacement if ($name == 'replacement') { $this->replacement = $value; } // Set subject if ($name == 'subject') { $this->subject = $value; } } }
/** * Initialize consent filter. * * This is the constructor for the consent filter. It validates and parses the configuration. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); $this->includeValues = FALSE; if (array_key_exists('includeValues', $config)) { $this->includeValues = $config['includeValues']; } if (array_key_exists('checked', $config)) { $this->checked = $config['checked']; } if (array_key_exists('focus', $config)) { $this->focus = $config['focus']; if (!in_array($this->focus, array('yes', 'no'), TRUE)) { throw new Exception('Invalid value for \'focus\'-parameter to' . ' consent:Consent authentication filter: ' . var_export($this->focus, TRUE)); } } else { $this->focus = NULL; } $this->store = NULL; if (array_key_exists('store', $config)) { try { $this->store = sspmod_consent_Store::parseStoreConfig($config['store']); } catch (Exception $e) { SimpleSAML_Logger::error('Consent - constructor() : Could not create consent storage: ' . $e->getMessage()); } } if (array_key_exists('hiddenAttributes', $config)) { $this->hiddenAttributes = $config['hiddenAttributes']; } else { $this->hiddenAttributes = array(); } }
/** * Initialize this filter. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); /* Validate configuration. */ foreach ($config as $name => $value) { if (is_int($name)) { // check if this is an option if ($value === '%replace') { $this->replace = true; } elseif ($value === '%keep') { $this->keep = true; } else { throw new SimpleSAML_Error_Exception('Unknown flag : ' . var_export($value, true)); } continue; } // Set targetattribute if ($name === 'targetattribute') { $this->targetattribute = $value; } // Set sourceattribute if ($name === 'sourceattribute') { $this->sourceattribute = $value; } // Set values if ($name === 'values') { $this->values = $value; } } }
public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); if (array_key_exists('candidates', $config)) { $this->_candidates = $config['candidates']; if (!is_array($this->_candidates)) { throw new Exception('SmartID authproc configuration error: \'candidates\' should be an array.'); } } if (array_key_exists('id_attribute', $config)) { $this->_id_attribute = $config['id_attribute']; if (!is_string($this->_id_attribute)) { throw new Exception('SmartID authproc configuration error: \'id_attribute\' should be a string.'); } } if (array_key_exists('add_authority', $config)) { $this->_add_authority = $config['add_authority']; if (!is_bool($this->_add_authority)) { throw new Exception('SmartID authproc configuration error: \'add_authority\' should be a boolean.'); } } if (array_key_exists('add_candidate', $config)) { $this->_add_candidate = $config['add_candidate']; if (!is_bool($this->_add_candidate)) { throw new Exception('SmartID authproc configuration error: \'add_candidate\' should be a boolean.'); } } }
/** * Initialize this filter. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); if (array_key_exists('warndaysbefore', $config)) { $this->warndaysbefore = $config['warndaysbefore']; if (!is_string($this->warndaysbefore)) { throw new Exception('Invalid value for number of days given to expirycheck::ExpiryDate filter.'); } } if (array_key_exists('netid_attr', $config)) { $this->netid_attr = $config['netid_attr']; if (!is_string($this->netid_attr)) { throw new Exception('Invalid attribute name given as eduPersonPrincipalName to expirycheck::ExpiryDate filter.'); } } if (array_key_exists('expirydate_attr', $config)) { $this->expirydate_attr = $config['expirydate_attr']; if (!is_string($this->expirydate_attr)) { throw new Exception('Invalid attribute name given as schacExpiryDate to expirycheck::ExpiryDate filter.'); } } if (array_key_exists('date_format', $config)) { $this->date_format = $config['date_format']; if (!is_string($this->date_format)) { throw new Exception('Invalid date format given to expirycheck::ExpiryDate filter.'); } } }
/** * Initialize this filter. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); foreach ($config as $name => $values) { if (is_int($name)) { if ($values === '%replace') { $this->replace = TRUE; } else { throw new Exception('Unknown flag: ' . var_export($values, TRUE)); } continue; } if (!is_string($name)) { throw new Exception('Invalid attribute name: ' . var_export($name, TRUE)); } if (!is_array($values)) { $values = array($values); } foreach ($values as $value) { if (!is_string($value)) { throw new Exception('Invalid value for attribute ' . $name . ': ' . var_export($values, TRUE)); } } $this->attributes[$name] = $values; } }
/** * Initialize this filter. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. * @throws SimpleSAML_Error_Exception In case of invalid configuration. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); // parse filter configuration foreach ($config as $name => $value) { if (is_int($name)) { // check if this is an option if ($value === '%replace') { $this->replace = TRUE; } elseif ($value === '%remove') { $this->remove = TRUE; } else { throw new SimpleSAML_Error_Exception('Unknown flag : ' . var_export($value, TRUE)); } continue; } // Set pattern if ($name === 'pattern') { $this->pattern = $value; } // Set replacement if ($name === 'replacement') { $this->replacement = $value; } // Set subject if ($name === 'subject') { $this->subject = $value; } // Set target if ($name === 'target') { $this->target = $value; } } }
/** * Initialize this filter, parse configuration * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); $mapFiles = array(); foreach ($config as $origName => $newName) { if (is_int($origName)) { if ($newName === '%duplicate') { $this->duplicate = TRUE; } else { /* No index given - this is a map file. */ $mapFiles[] = $newName; } continue; } if (!is_string($origName)) { throw new Exception('Invalid attribute name: ' . var_export($origName, TRUE)); } if (!is_string($newName) && !is_array($newName)) { throw new Exception('Invalid attribute name: ' . var_export($newName, TRUE)); } $this->map[$origName] = $newName; } // Load map files after we determine dupilicate or rename foreach ($mapFiles as &$file) { $this->loadMapFile($file); } }
/** * Constructor for the processing filter. * * @param array &$config Configuration for this filter. * @param mixed $reserved For future use. */ public function __construct(&$config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); if (array_key_exists('attributes', $config) && !empty($config['attributes'])) { $this->scopedAttributes = $config['attributes']; } }
/** * Initialize this filter, parse configuration * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); $config = SimpleSAML_Configuration::loadFromArray($config, 'ScopeFromAttribute'); $this->targetAttribute = $config->getString('targetAttribute'); $this->sourceAttribute = $config->getString('sourceAttribute'); }
/** * Initialize this filter. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); if (array_key_exists('attributename', $config)) { $this->attributename = $config['attributename']; } }
/** * Initialize this filter, parse configuration * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); if (!isset($config['code'])) { throw new SimpleSAML_Error_Exception($this->authId . ': Missing required \'code\' option.'); } $this->code = (string) $config['code']; }
/** * Initialize this filter. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); if (!isset($config['AuthnContextClassRef'])) { throw new SimpleSAML_Error_Exception('Missing AuthnContextClassRef option in processing filter.'); } $this->authnContextClassRef = (string) $config['AuthnContextClassRef']; }
/** * Initialize this filter, parse configuration * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. * * @throws SimpleSAML_Error_Exception if the 'code' option is not defined. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); if (!isset($config['code'])) { throw new SimpleSAML_Error_Exception("core:PHP: missing mandatory configuration option 'code'."); } $this->code = (string) $config['code']; }
/** * Initialize this filter. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); if (!isset($config['domain'])) { throw new SimpleSAML_Error_Exception('Missing domain option in cdc:CDC filter.'); } $this->domain = (string) $config['domain']; $this->client = new sspmod_cdc_Client($this->domain); }
/** * Initialize this filter, parse configuration * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. * * @throws SimpleSAML_Error_Exception if the mandatory 'accepted' configuration option is missing. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); if (empty($config['accepted'])) { SimpleSAML_Logger::error('ExpectedAuthnContextClassRef: Configuration error. There is no accepted AuthnContextClassRef.'); throw new SimpleSAML_Error_Exception('ExpectedAuthnContextClassRef: Configuration error. There is no accepted AuthnContextClassRef.'); } $this->accepted = $config['accepted']; }
/** * Initialize consent filter. * * This is the constructor for the consent filter. It validates and parses the configuration. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); if (isset($config["uidAttribute"])) { $this->_uidAttribute = $config["uidAttribute"]; } if (isset($config["cnAttribute"])) { $this->_cnAttribute = $config["cnAttribute"]; } assert('is_array($config)'); }
public function __construct($config, $reserved) { parent::__construct($config, $reserved); $params = array('api_url', 'nameId_attribute_name'); foreach ($params as $param) { if (!array_key_exists($param, $config)) { throw new SimpleSAML_Error_Exception('Missing required attribute: ' . $param); } $this->as_config[$param] = $config[$param]; } }
/** * Initialize this filter. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); foreach ($config as $name => $value) { if (!is_string($name)) { throw new Exception('Invalid authModule name: ' . var_export($name, TRUE)); } $this->map[$name] = $value; } }
/** * Initialize this filter. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); foreach ($config as $name) { if (!is_string($name)) { throw new Exception('Invalid attribute name: ' . var_export($name, TRUE)); } $this->allowedAttributes[] = $name; } }
/** * Initialize this filter. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); if (!array_key_exists("uidfield", $config)) { throw new Exception('No uidfield specified in configuration'); } $this->uidfield = $config["uidfield"]; $this->collector = $this->getCollector($config); if (array_key_exists("existing", $config)) { $this->existing = $config["existing"]; } }
/** * Initialize this filter, parse configuration * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); foreach ($config as $source => $destination) { if (!is_string($source)) { throw new Exception('Invalid source attribute name: ' . var_export($source, TRUE)); } if (!is_string($destination)) { throw new Exception('Invalid destination attribute name: ' . var_export($destination, TRUE)); } $this->map[$source] = $destination; } }
/** * Initialize Duo Security * * Validates and parses the configuration * * @param array $config Configuration information */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); $this->_host = $config['host']; $this->_akey = $config['akey']; $this->_ikey = $config['ikey']; $this->_skey = $config['skey']; if (array_key_exists('authSources', $config)) { $this->_authSources = $config['authSources']; } if (array_key_exists('usernameAttribute', $config)) { $this->_usernameAttribute = $config['usernameAttribute']; } }
/** * Initialize this filter, parse configuration. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); if (isset($config['NameQualifier'])) { $this->nameQualifier = $config['NameQualifier']; } else { $this->nameQualifier = FALSE; } if (isset($config['SPNameQualifier'])) { $this->spNameQualifier = $config['SPNameQualifier']; } else { $this->spNameQualifier = TRUE; } }
/** * Initialize this filter, parse configuration. * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); if (isset($config['attribute'])) { $this->attribute = (string) $config['attribute']; } else { $this->attribute = 'eduPersonTargetedID'; } if (isset($config['nameId'])) { $this->nameId = (bool) $config['nameId']; } else { $this->nameId = true; } }
/** * Initialize this filter, parse configuration * * @param array $config Configuration information about this filter. * @param mixed $reserved For future use. */ public function __construct($config, $reserved) { parent::__construct($config, $reserved); assert('is_array($config)'); if (isset($config['function'])) { $this->function = $config['function']; } else { // TODO: remove this branch after removing the 'code' option. if (!isset($config['code'])) { throw new SimpleSAML_Error_Exception("core:PHP: Neither 'function' nor 'code' options defined."); } SimpleSAML_Logger::warning("Deprecated 'code' configuration option in PHP authentication processing filter."); $this->code = (string) $config['code']; } }
/** * Initialize consent filter * * Validates and parses the configuration * * @param array $config Configuration information * @param mixed $reserved For future use */ public function __construct($config, $reserved) { assert('is_array($config)'); parent::__construct($config, $reserved); if (array_key_exists('includeValues', $config)) { if (!is_bool($config['includeValues'])) { throw new SimpleSAML_Error_Exception('Consent: includeValues must be boolean. ' . var_export($config['includeValues']) . ' given.'); } $this->_includeValues = $config['includeValues']; } if (array_key_exists('checked', $config)) { if (!is_bool($config['checked'])) { throw new SimpleSAML_Error_Exception('Consent: checked must be boolean. ' . var_export($config['checked']) . ' given.'); } $this->_checked = $config['checked']; } if (array_key_exists('focus', $config)) { if (!in_array($config['focus'], array('yes', 'no'), true)) { throw new SimpleSAML_Error_Exception('Consent: focus must be a string with values `yes` or `no`. ' . var_export($config['focus']) . ' given.'); } $this->_focus = $config['focus']; } if (array_key_exists('hiddenAttributes', $config)) { if (!is_array($config['hiddenAttributes'])) { throw new SimpleSAML_Error_Exception('Consent: hiddenAttributes must be an array. ' . var_export($config['hiddenAttributes']) . ' given.'); } $this->_hiddenAttributes = $config['hiddenAttributes']; } if (array_key_exists('noconsentattributes', $config)) { if (!is_array($config['noconsentattributes'])) { throw new SimpleSAML_Error_Exception('Consent: noconsentattributes must be an array. ' . var_export($config['noconsentattributes']) . ' given.'); } $this->_noconsentattributes = $config['noconsentattributes']; } if (array_key_exists('store', $config)) { try { $this->_store = sspmod_consent_Store::parseStoreConfig($config['store']); } catch (Exception $e) { SimpleSAML_Logger::error('Consent: Could not create consent storage: ' . $e->getMessage()); } } if (array_key_exists('showNoConsentAboutService', $config)) { if (!is_bool($config['showNoConsentAboutService'])) { throw new SimpleSAML_Error_Exception('Consent: showNoConsentAboutService must be a boolean.'); } $this->_showNoConsentAboutService = $config['showNoConsentAboutService']; } }