Definition at line 31 of file TargetedID.php.
◆ __construct()
sspmod_core_Auth_Process_TargetedID::__construct |
( |
|
$config, |
|
|
|
$reserved |
|
) |
| |
Initialize this filter.
- Parameters
-
array | $config | Configuration information about this filter. |
mixed | $reserved | For future use. |
Definition at line 55 of file TargetedID.php.
References $config.
56 parent::__construct(
$config, $reserved);
58 assert(
'is_array($config)');
60 if (array_key_exists(
'attributename',
$config)) {
61 $this->attribute =
$config[
'attributename'];
62 if (!is_string($this->attribute)) {
63 throw new Exception(
'Invalid attribute name given to core:TargetedID filter.');
67 if (array_key_exists(
'nameId',
$config)) {
68 $this->generateNameId =
$config[
'nameId'];
69 if (!is_bool($this->generateNameId)) {
70 throw new Exception(
'Invalid value of \'nameId\'-option to core:TargetedID filter.');
◆ getEntityId()
static sspmod_core_Auth_Process_TargetedID::getEntityId |
( |
|
$metadata | ) |
|
|
staticprivate |
Generate ID from entity metadata.
This function takes in the metadata of an entity, and attempts to generate an unique identifier based on that.
- Parameters
-
array | $metadata | The metadata of the entity. |
- Returns
- string The unique identifier for the entity.
Definition at line 154 of file TargetedID.php.
155 assert(
'is_array($metadata)');
159 if (array_key_exists(
'metadata-set',
$metadata)) {
161 $id .=
'set' . strlen($set) .
':' . $set;
164 if (array_key_exists(
'entityid',
$metadata)) {
166 $id .=
'set' . strlen($entityid) .
':' . $entityid;
if(!array_key_exists('StateId', $_REQUEST)) $id
$metadata['__DYNAMIC:1__']
◆ process()
sspmod_core_Auth_Process_TargetedID::process |
( |
& |
$state | ) |
|
Apply filter to add the targeted ID.
- Parameters
-
array | &$state | The current state. |
Definition at line 81 of file TargetedID.php.
References $state, is, and to.
82 assert(
'is_array($state)');
83 assert(
'array_key_exists("Attributes", $state)');
85 if ($this->attribute === NULL) {
86 if (!array_key_exists(
'UserID',
$state)) {
87 throw new Exception(
'core:TargetedID: Missing UserID for this user. Please' .
88 ' check the \'userid.attribute\' option in the metadata against the' .
89 ' attributes provided by the authentication source.');
92 $userID =
$state[
'UserID'];
94 if (!array_key_exists($this->attribute,
$state[
'Attributes'])) {
95 throw new Exception(
'core:TargetedID: Missing attribute \'' . $this->attribute .
96 '\', which
is needed
to generate the targeted ID.
'); 99 $userID = $state['Attributes
'][$this->attribute][0]; 103 $secretSalt = SimpleSAML\Utils\Config::getSecretSalt(); 105 if (array_key_exists('Source
', $state)) { 106 $srcID = self::getEntityId($state['Source
']); 111 if (array_key_exists('Destination
', $state)) { 112 $dstID = self::getEntityId($state['Destination
']); 117 $uidData = 'uidhashbase
' . $secretSalt; 118 $uidData .= strlen($srcID) . ':
' . $srcID; 119 $uidData .= strlen($dstID) . ':
' . $dstID; 120 $uidData .= strlen($userID) . ':
' . $userID; 121 $uidData .= $secretSalt; 123 $uid = hash('sha1
', $uidData); 125 if ($this->generateNameId) { 126 // Convert the targeted ID to a SAML 2.0 name identifier element 127 $nameId = new \SAML2\XML\saml\NameID(); 128 $nameId->value = $uid; 129 $nameId->Format = \SAML2\Constants::NAMEID_PERSISTENT; 131 if (isset($state['Source
']['entityid
'])) { 132 $nameId->NameQualifier = $state['Source
']['entityid
']; 134 if (isset($state['Destination
']['entityid
'])) { 135 $nameId->SPNameQualifier = $state['Destination
']['entityid
']; 141 $state['Attributes
']['eduPersonTargetedID
'] = array($nameId);
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
◆ $attribute
sspmod_core_Auth_Process_TargetedID::$attribute = NULL |
|
private |
The attribute we should generate the targeted id from, or NULL if we should use the UserID.
Definition at line 38 of file TargetedID.php.
◆ $generateNameId
sspmod_core_Auth_Process_TargetedID::$generateNameId = FALSE |
|
private |
The documentation for this class was generated from the following file:
- libs/composer/vendor/simplesamlphp/simplesamlphp/modules/core/lib/Auth/Process/TargetedID.php