@@ -23,7 +23,7 @@ class SQLPersistentNameID extends BaseNameIDGenerator
2323 *
2424 * @var string
2525 */
26- private string $ attribute ;
26+ private string $ identifyingAttribute ;
2727
2828 /**
2929 * Whether we should create a persistent NameID if not explicitly requested (as saml:PersistentNameID does).
@@ -60,18 +60,18 @@ class SQLPersistentNameID extends BaseNameIDGenerator
6060 * @param array $config Configuration information about this filter.
6161 * @param mixed $reserved For future use.
6262 *
63- * @throws \SimpleSAML\Error\Exception If the 'attribute ' option is not specified.
63+ * @throws \SimpleSAML\Error\Exception If the 'identifyingAttribute ' option is not specified.
6464 */
6565 public function __construct (array &$ config , $ reserved )
6666 {
6767 parent ::__construct ($ config , $ reserved );
6868
6969 $ this ->format = Constants::NAMEID_PERSISTENT ;
7070
71- if (!isset ($ config ['attribute ' ])) {
72- throw new Error \Exception ("PersistentNameID: Missing required option 'attribute '. " );
71+ if (!isset ($ config ['identifyingAttribute ' ])) {
72+ throw new Error \Exception ("PersistentNameID: Missing required option 'identifyingAttribute '. " );
7373 }
74- $ this ->attribute = $ config ['attribute ' ];
74+ $ this ->identifyingAttribute = $ config ['identifyingAttribute ' ];
7575
7676 if (isset ($ config ['allowUnspecified ' ])) {
7777 $ this ->allowUnspecified = (bool ) $ config ['allowUnspecified ' ];
@@ -137,26 +137,31 @@ protected function getValue(array &$state): ?string
137137 }
138138 $ idpEntityId = $ state ['Source ' ]['entityid ' ];
139139
140- if (!isset ($ state ['Attributes ' ][$ this ->attribute ]) || count ($ state ['Attributes ' ][$ this ->attribute ]) === 0 ) {
140+ if (
141+ !isset ($ state ['Attributes ' ][$ this ->identifyingAttribute ])
142+ || count ($ state ['Attributes ' ][$ this ->identifyingAttribute ]) === 0
143+ ) {
141144 Logger::warning (
142- 'SQLPersistentNameID: Missing attribute ' . var_export ($ this ->attribute , true ) .
145+ 'SQLPersistentNameID: Missing attribute ' . var_export ($ this ->identifyingAttribute , true ) .
143146 ' on user - not generating persistent NameID. '
144147 );
145148 return null ;
146149 }
147- if (count ($ state ['Attributes ' ][$ this ->attribute ]) > 1 ) {
150+ if (count ($ state ['Attributes ' ][$ this ->identifyingAttribute ]) > 1 ) {
148151 Logger::warning (
149- 'SQLPersistentNameID: More than one value in attribute ' . var_export ($ this ->attribute , true ) .
152+ 'SQLPersistentNameID: More than one value in attribute ' .
153+ var_export ($ this ->identifyingAttribute , true ) .
150154 ' on user - not generating persistent NameID. '
151155 );
152156 return null ;
153157 }
154- $ uid = array_values ($ state ['Attributes ' ][$ this ->attribute ]); // just in case the first index is no longer 0
158+ // just in case the first index is no longer 0
159+ $ uid = array_values ($ state ['Attributes ' ][$ this ->identifyingAttribute ]);
155160 $ uid = $ uid [0 ];
156161
157162 if (empty ($ uid )) {
158163 Logger::warning (
159- 'Empty value in attribute ' . var_export ($ this ->attribute , true ) .
164+ 'Empty value in attribute ' . var_export ($ this ->identifyingAttribute , true ) .
160165 ' on user - not generating persistent NameID. '
161166 );
162167 return null ;
0 commit comments