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

Public Member Functions

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

Static Private Member Functions

static parseFormat ($format)
 Parse a NameID format string into an array. More...
 

Private Attributes

 $attribute
 
 $format
 

Additional Inherited Members

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

Detailed Description

Definition at line 9 of file NameIDAttribute.php.

Constructor & Destructor Documentation

◆ __construct()

sspmod_saml_Auth_Process_NameIDAttribute::__construct (   $config,
  $reserved 
)

Initialize this filter, parse configuration.

Parameters
array$configConfiguration information about this filter.
mixed$reservedFor future use.

Definition at line 34 of file NameIDAttribute.php.

35 {
36 parent::__construct($config, $reserved);
37 assert(is_array($config));
38
39 if (isset($config['attribute'])) {
40 $this->attribute = (string) $config['attribute'];
41 } else {
42 $this->attribute = 'nameid';
43 }
44
45 if (isset($config['format'])) {
46 $format = (string) $config['format'];
47 } else {
48 $format = '%I!%S!%V';
49 }
50
51 $this->format = self::parseFormat($format);
52 }
static parseFormat($format)
Parse a NameID format string into an array.
$config
Definition: bootstrap.php:15

References $config, $format, and parseFormat().

+ Here is the call graph for this function:

Member Function Documentation

◆ parseFormat()

static sspmod_saml_Auth_Process_NameIDAttribute::parseFormat (   $format)
staticprivate

Parse a NameID format string into an array.

Parameters
string$formatThe format string.
Returns
array The format string broken into its individual components.
Exceptions
SimpleSAML_Error_Exceptionif the replacement is invalid.

Definition at line 63 of file NameIDAttribute.php.

64 {
65 assert(is_string($format));
66
67 $ret = array();
68 $pos = 0;
69 while (($next = strpos($format, '%', $pos)) !== false) {
70 $ret[] = substr($format, $pos, $next - $pos);
71
72 $replacement = $format[$next + 1];
73 switch ($replacement) {
74 case 'F':
75 $ret[] = 'Format';
76 break;
77 case 'I':
78 $ret[] = 'NameQualifier';
79 break;
80 case 'S':
81 $ret[] = 'SPNameQualifier';
82 break;
83 case 'V':
84 $ret[] = 'value';
85 break;
86 case '%':
87 $ret[] = '%';
88 break;
89 default:
90 throw new SimpleSAML_Error_Exception('NameIDAttribute: Invalid replacement: "%'.$replacement.'"');
91 }
92
93 $pos = $next + 2;
94 }
95 $ret[] = substr($format, $pos);
96
97 return $ret;
98 }
$ret
Definition: parser.php:6

References $format, and $ret.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ process()

sspmod_saml_Auth_Process_NameIDAttribute::process ( $state)

Convert NameID to attribute.

Parameters
array&$stateThe request state.

Reimplemented from SimpleSAML_Auth_ProcessingFilter.

Definition at line 106 of file NameIDAttribute.php.

107 {
108 assert(is_array($state));
109 assert(isset($state['Source']['entityid']));
110 assert(isset($state['Destination']['entityid']));
111
112 if (!isset($state['saml:sp:NameID'])) {
113 return;
114 }
115
116 $rep = $state['saml:sp:NameID'];
117 assert(isset($rep->value));
118
119 $rep->{'%'} = '%';
120 if (!isset($rep->Format)) {
122 }
123 if (!isset($rep->NameQualifier)) {
124 $rep->NameQualifier = $state['Source']['entityid'];
125 }
126 if (!isset($rep->SPNameQualifier)) {
127 $rep->SPNameQualifier = $state['Destination']['entityid'];
128 }
129
130 $value = '';
131 $isString = true;
132 foreach ($this->format as $element) {
133 if ($isString) {
134 $value .= $element;
135 } else {
136 $value .= $rep->$element;
137 }
138 $isString = !$isString;
139 }
140
141 $state['Attributes'][$this->attribute] = array($value);
142 }
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
const NAMEID_UNSPECIFIED
Unspecified NameID format.
Definition: Constants.php:165

References $state.

Field Documentation

◆ $attribute

sspmod_saml_Auth_Process_NameIDAttribute::$attribute
private

Definition at line 17 of file NameIDAttribute.php.

◆ $format

sspmod_saml_Auth_Process_NameIDAttribute::$format
private

Definition at line 25 of file NameIDAttribute.php.

Referenced by __construct(), and parseFormat().


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