ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
sspmod_smartattributes_Auth_Process_SmartID Class Reference
+ Inheritance diagram for sspmod_smartattributes_Auth_Process_SmartID:
+ Collaboration diagram for sspmod_smartattributes_Auth_Process_SmartID:

Public Member Functions

 __construct ($config, $reserved)
 
 process (&$request)
 Apply filter to add or replace attributes. More...
 
- Public Member Functions inherited from SimpleSAML_Auth_ProcessingFilter
 __construct (&$config, $reserved)
 Constructor for a processing filter. More...
 
 process (&$request)
 Process a request. More...
 

Private Member Functions

 addID ($attributes, $request)
 

Private Attributes

 $_candidates
 Which attributes to use as identifiers? More...
 
 $_id_attribute = 'smart_id'
 The name of the generated ID attribute. More...
 
 $_add_authority = true
 Whether to append the AuthenticatingAuthority, separated by '!' This only works when SSP is used as a gateway. More...
 
 $_add_candidate = true
 Whether to prepend the CandidateID, separated by ':'. More...
 
 $attributes = array()
 Attributes which should be added/appended. More...
 

Additional Inherited Members

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

Detailed Description

Definition at line 3 of file SmartID.php.

Constructor & Destructor Documentation

◆ __construct()

sspmod_smartattributes_Auth_Process_SmartID::__construct (   $config,
  $reserved 
)

Definition at line 46 of file SmartID.php.

References $config.

47  {
48  parent::__construct($config, $reserved);
49 
50  assert(is_array($config));
51 
52  if (array_key_exists('candidates', $config)) {
53  $this->_candidates = $config['candidates'];
54  if (!is_array($this->_candidates)) {
55  throw new Exception('SmartID authproc configuration error: \'candidates\' should be an array.');
56  }
57  }
58 
59  if (array_key_exists('id_attribute', $config)) {
60  $this->_id_attribute = $config['id_attribute'];
61  if (!is_string($this->_id_attribute)) {
62  throw new Exception('SmartID authproc configuration error: \'id_attribute\' should be a string.');
63  }
64  }
65 
66  if (array_key_exists('add_authority', $config)) {
67  $this->_add_authority = $config['add_authority'];
68  if (!is_bool($this->_add_authority)) {
69  throw new Exception('SmartID authproc configuration error: \'add_authority\' should be a boolean.');
70  }
71  }
72 
73  if (array_key_exists('add_candidate', $config)) {
74  $this->_add_candidate = $config['add_candidate'];
75  if (!is_bool($this->_add_candidate)) {
76  throw new Exception('SmartID authproc configuration error: \'add_candidate\' should be a boolean.');
77  }
78  }
79  }
$config
Definition: bootstrap.php:15

Member Function Documentation

◆ addID()

sspmod_smartattributes_Auth_Process_SmartID::addID (   $attributes,
  $request 
)
private

Definition at line 81 of file SmartID.php.

References $attributes, $request, and $state.

Referenced by process().

82  {
83  $state = $request['saml:sp:State'];
84  foreach ($this->_candidates as $idCandidate) {
85  if (isset($attributes[$idCandidate][0])) {
86  if (($this->_add_authority) && (isset($state['saml:AuthenticatingAuthority'][0]))) {
87  return ($this->_add_candidate ? $idCandidate.':' : '').$attributes[$idCandidate][0].'!'.$state['saml:AuthenticatingAuthority'][0];
88  } else {
89  return ($this->_add_candidate ? $idCandidate.':' : '').$attributes[$idCandidate][0];
90  }
91  }
92  }
93  /*
94  * At this stage no usable id_candidate has been detected.
95  */
96  throw new SimpleSAML_Error_Exception('This service needs at least one of the following
97  attributes to identity users: '.implode(', ', $this->_candidates).'. Unfortunately not
98  one of them was detected. Please ask your institution administrator to release one of
99  them, or try using another identity provider.');
100  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
$attributes
Attributes which should be added/appended.
Definition: SmartID.php:43
+ Here is the caller graph for this function:

◆ process()

sspmod_smartattributes_Auth_Process_SmartID::process ( $request)

Apply filter to add or replace attributes.

Add or replace existing attributes with the configured values.

Parameters
array&$requestThe current request

Definition at line 109 of file SmartID.php.

References $_id_attribute, $id, $request, and addID().

110  {
111  assert(is_array($request));
112  assert(array_key_exists('Attributes', $request));
113 
114  $id = $this->addID($request['Attributes'], $request);
115 
116  if (isset($id)) {
117  $request['Attributes'][$this->_id_attribute] = array($id);
118  }
119  }
foreach($paths as $path) $request
Definition: asyncclient.php:32
$_id_attribute
The name of the generated ID attribute.
Definition: SmartID.php:25
if(!array_key_exists('StateId', $_REQUEST)) $id
+ Here is the call graph for this function:

Field Documentation

◆ $_add_authority

sspmod_smartattributes_Auth_Process_SmartID::$_add_authority = true
private

Whether to append the AuthenticatingAuthority, separated by '!' This only works when SSP is used as a gateway.

Definition at line 31 of file SmartID.php.

◆ $_add_candidate

sspmod_smartattributes_Auth_Process_SmartID::$_add_candidate = true
private

Whether to prepend the CandidateID, separated by ':'.

Definition at line 36 of file SmartID.php.

◆ $_candidates

sspmod_smartattributes_Auth_Process_SmartID::$_candidates
private
Initial value:
= array(
'eduPersonTargetedID',
'eduPersonPrincipalName',
'openid',
'facebook_targetedID',
'twitter_targetedID',
'windowslive_targetedID',
'linkedin_targetedID',
)

Which attributes to use as identifiers?

IMPORTANT: If you use the (default) attributemaps (twitter2name, facebook2name, etc., be sure to comment out the entries that map xxx_targetedID to eduPersonTargetedID, or there will be no way to see its origin any more.

Definition at line 12 of file SmartID.php.

◆ $_id_attribute

sspmod_smartattributes_Auth_Process_SmartID::$_id_attribute = 'smart_id'
private

The name of the generated ID attribute.

Definition at line 25 of file SmartID.php.

Referenced by process().

◆ $attributes

sspmod_smartattributes_Auth_Process_SmartID::$attributes = array()
private

Attributes which should be added/appended.

Associative array of arrays.

Definition at line 43 of file SmartID.php.

Referenced by addID().


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