/**
* 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']);
}
}