77 assert(
'is_array($config)');
78 parent::__construct(
$config, $reserved);
80 if (array_key_exists(
'includeValues',
$config)) {
81 if (!is_bool(
$config[
'includeValues'])) {
83 'Consent: includeValues must be boolean. '.
84 var_export(
$config[
'includeValues'],
true).
' given.' 87 $this->_includeValues =
$config[
'includeValues'];
90 if (array_key_exists(
'checked',
$config)) {
91 if (!is_bool(
$config[
'checked'])) {
93 'Consent: checked must be boolean. '.
94 var_export(
$config[
'checked'],
true).
' given.' 97 $this->_checked =
$config[
'checked'];
100 if (array_key_exists(
'focus',
$config)) {
101 if (!in_array(
$config[
'focus'],
array(
'yes',
'no'),
true)) {
103 'Consent: focus must be a string with values `yes` or `no`. '.
104 var_export(
$config[
'focus'],
true).
' given.' 107 $this->_focus =
$config[
'focus'];
110 if (array_key_exists(
'hiddenAttributes',
$config)) {
111 if (!is_array(
$config[
'hiddenAttributes'])) {
113 'Consent: hiddenAttributes must be an array. '.
114 var_export(
$config[
'hiddenAttributes'],
true).
' given.' 117 $this->_hiddenAttributes =
$config[
'hiddenAttributes'];
120 if (array_key_exists(
'noconsentattributes',
$config)) {
121 if (!is_array(
$config[
'noconsentattributes'])) {
123 'Consent: noconsentattributes must be an array. '.
124 var_export(
$config[
'noconsentattributes'],
true).
' given.' 127 $this->_noconsentattributes =
$config[
'noconsentattributes'];
130 if (array_key_exists(
'store',
$config)) {
135 'Consent: Could not create consent storage: '.
141 if (array_key_exists(
'showNoConsentAboutService',
$config)) {
142 if (!is_bool(
$config[
'showNoConsentAboutService'])) {
145 $this->_showNoConsentAboutService =
$config[
'showNoConsentAboutService'];
160 if (is_array($option)) {
162 if (count($option) === count($option, COUNT_RECURSIVE)) {
164 return in_array(
$entityId, $option,
true);
168 if (in_array(
$entityId, $option,
true)) {
173 foreach ($option as $optionToTest) {
174 if (!is_array($optionToTest)) {
178 if (!array_key_exists(
'type', $optionToTest)) {
183 if ($optionToTest[
'type'] ===
'regex') {
186 if (!array_key_exists(
'pattern', $optionToTest)) {
190 if (preg_match($optionToTest[
'pattern'],
$entityId) === 1) {
202 return (
boolean) $option;
221 assert(
'is_array($state)');
222 assert(
'array_key_exists("UserID", $state)');
223 assert(
'array_key_exists("Destination", $state)');
224 assert(
'array_key_exists("entityid", $state["Destination"])');
225 assert(
'array_key_exists("metadata-set", $state["Destination"])');
226 assert(
'array_key_exists("entityid", $state["Source"])');
227 assert(
'array_key_exists("metadata-set", $state["Source"])');
240 if (isset(
$state[
'saml:sp:IdP'])) {
249 if (isset(
$state[
'Source'][
'consent.disable']) &&
256 if (isset(
$state[
'Destination'][
'consent.disable']) &&
264 if ($this->_store !== null) {
271 if (in_array($attrkey, $this->_noconsentattributes,
true)) {
282 $attributeSet = self::getAttributeHash(
$attributes, $this->_includeValues);
285 'Consent: hasConsent() ['.$userId.
'|'.$targetedId.
'|'.
290 if ($this->_store->hasConsent($userId, $targetedId, $attributeSet)) {
301 $state[
'consent:store.userId'] = $userId;
302 $state[
'consent:store.destination'] = $targetedId;
303 $state[
'consent:store.attributeSet'] = $attributeSet;
321 if (isset(
$state[
'isPassive']) &&
$state[
'isPassive'] ===
true) {
376 if ($includeValues) {
382 $hashBase = implode(
'|',
$names);
384 return hash(
'sha1', $hashBase);
static getTargetedID($userid, $source, $destination)
Generate a unique targeted identifier.
__construct($config, $reserved)
Initialize consent filter.
static getHashedUserID($userid, $source)
Generate a unique identifier of the user.
if(empty($userids)) $userid
if(!array_key_exists('StateId', $_REQUEST)) $id
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
$metadata['__DYNAMIC:1__']
Class SimpleSAML_Error_NoPassive.
static getModuleURL($resource, array $parameters=array())
Get absolute URL to a specified module resource.
process(&$state)
Process a authentication response.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Attribute-related utility methods.
static getAttributeHash($attributes, $includeValues=false)
Generate unique identifier for attributes.
Create styles array
The data for the language used.
$_showNoConsentAboutService
static parseStoreConfig($config)
Parse consent storage configuration.
hash(StreamInterface $stream, $algo, $rawOutput=false)
Calculate a hash of a Stream.
static checkDisable($option, $entityId)
Helper function to check whether consent is disabled.
static saveState(&$state, $stage, $rawId=false)
Save the state.
static log($event, array $data=array())
Notify about an event.