ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
sspmod_saml_Auth_Process_PersistentNameID Class Reference
+ Inheritance diagram for sspmod_saml_Auth_Process_PersistentNameID:
+ Collaboration diagram for sspmod_saml_Auth_Process_PersistentNameID:

Public Member Functions

 __construct ($config, $reserved)
 Initialize this filter, parse configuration. More...
 
- Public Member Functions inherited from sspmod_saml_BaseNameIDGenerator
 __construct ($config, $reserved)
 Initialize this filter, parse configuration. More...
 
 process (&$state)
 Generate transient NameID. More...
 
- Public Member Functions inherited from SimpleSAML_Auth_ProcessingFilter
 __construct (&$config, $reserved)
 Constructor for a processing filter. More...
 
 process (&$request)
 Process a request. More...
 

Protected Member Functions

 getValue (array &$state)
 Get the NameID value. More...
 
- Protected Member Functions inherited from sspmod_saml_BaseNameIDGenerator
 getValue (array &$state)
 Get the NameID value. More...
 

Private Attributes

 $attribute
 

Additional Inherited Members

- Data Fields inherited from SimpleSAML_Auth_ProcessingFilter
 $priority = 50
 Priority of this filter. More...
 
- Protected Attributes inherited from sspmod_saml_BaseNameIDGenerator
 $format
 

Detailed Description

Definition at line 9 of file PersistentNameID.php.

Constructor & Destructor Documentation

◆ __construct()

sspmod_saml_Auth_Process_PersistentNameID::__construct (   $config,
  $reserved 
)

Initialize this filter, parse configuration.

Parameters
array$configConfiguration information about this filter.
mixed$reservedFor future use.
Exceptions
SimpleSAML_Error_ExceptionIf the required option 'attribute' is missing.

Definition at line 28 of file PersistentNameID.php.

References $config, format, and SAML2\Constants\NAMEID_PERSISTENT.

29  {
30  parent::__construct($config, $reserved);
31  assert('is_array($config)');
32 
34 
35  if (!isset($config['attribute'])) {
36  throw new SimpleSAML_Error_Exception("PersistentNameID: Missing required option 'attribute'.");
37  }
38  $this->attribute = $config['attribute'];
39  }
Write to Excel2007 format
const NAMEID_PERSISTENT
Persistent NameID format.
Definition: Constants.php:190

Member Function Documentation

◆ getValue()

sspmod_saml_Auth_Process_PersistentNameID::getValue ( array $state)
protected

Get the NameID value.

Parameters
array$stateThe state array.
Returns
string|null The NameID value.

Definition at line 48 of file PersistentNameID.php.

References $idpEntityId, $spEntityId, SimpleSAML\Utils\Config\getSecretSalt(), and SimpleSAML\Logger\warning().

49  {
50 
51  if (!isset($state['Destination']['entityid'])) {
52  SimpleSAML\Logger::warning('No SP entity ID - not generating persistent NameID.');
53  return null;
54  }
55  $spEntityId = $state['Destination']['entityid'];
56 
57  if (!isset($state['Source']['entityid'])) {
58  SimpleSAML\Logger::warning('No IdP entity ID - not generating persistent NameID.');
59  return null;
60  }
61  $idpEntityId = $state['Source']['entityid'];
62 
63  if (!isset($state['Attributes'][$this->attribute]) || count($state['Attributes'][$this->attribute]) === 0) {
65  'Missing attribute '.var_export($this->attribute, true).
66  ' on user - not generating persistent NameID.'
67  );
68  return null;
69  }
70  if (count($state['Attributes'][$this->attribute]) > 1) {
72  'More than one value in attribute '.var_export($this->attribute, true).
73  ' on user - not generating persistent NameID.'
74  );
75  return null;
76  }
77  $uid = array_values($state['Attributes'][$this->attribute]); // just in case the first index is no longer 0
78  $uid = $uid[0];
79 
80  if (empty($uid)) {
82  'Empty value in attribute '.var_export($this->attribute, true).
83  ' on user - not generating persistent NameID.'
84  );
85  return null;
86  }
87 
89 
90  $uidData = 'uidhashbase'.$secretSalt;
91  $uidData .= strlen($idpEntityId).':'.$idpEntityId;
92  $uidData .= strlen($spEntityId).':'.$spEntityId;
93  $uidData .= strlen($uid).':'.$uid;
94  $uidData .= $secretSalt;
95 
96  return sha1($uidData);
97  }
$idpEntityId
Definition: prp.php:12
$spEntityId
static getSecretSalt()
Retrieve the secret salt.
Definition: Config.php:49
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
static warning($string)
Definition: Logger.php:179
+ Here is the call graph for this function:

Field Documentation

◆ $attribute

sspmod_saml_Auth_Process_PersistentNameID::$attribute
private

Definition at line 17 of file PersistentNameID.php.


The documentation for this class was generated from the following file: