@@ -38,6 +38,7 @@ class sspmod_sqlattribs_Auth_Process_AttributeFromSQL extends SimpleSAML_Auth_Pr
38
38
*
39
39
* @param array $config Configuration information about this filter.
40
40
* @param mixed $reserved For future use.
41
+ * @throws SimpleSAML_Error_Exception
41
42
*/
42
43
public function __construct ($ config , $ reserved )
43
44
{
@@ -88,14 +89,15 @@ public function __construct($config, $reserved)
88
89
* Create a database connection.
89
90
*
90
91
* @return PDO The database connection.
92
+ * @throws SimpleSAML_Error_Exception
91
93
*/
92
94
private function connect ()
93
95
{
94
96
try {
95
97
$ db = new PDO ($ this ->dsn , $ this ->username , $ this ->password );
96
98
} catch (PDOException $ e ) {
97
- throw new SimpleSAML_Error_Exception ('AttributeFromSQL: Failed to connect to \'' .
98
- $ this ->dsn . '\': ' . $ e ->getMessage ());
99
+ throw new SimpleSAML_Error_Exception ('AttributeFromSQL: Failed to connect to \'' .
100
+ $ this ->dsn . '\': ' . $ e ->getMessage ());
99
101
}
100
102
$ db ->setAttribute (PDO ::ATTR_ERRMODE , PDO ::ERRMODE_EXCEPTION );
101
103
@@ -120,17 +122,18 @@ private function connect()
120
122
*
121
123
* Logic is largely the same as (and lifted from) sqlauth:sql
122
124
* @param mixed &$request
125
+ * @throws SimpleSAML_Error_Exception
123
126
*/
124
127
public function process (&$ request )
125
128
{
126
129
assert ('is_array($request) ' );
127
130
assert ('array_key_exists("Attributes", $request) ' );
128
- assert ('array_key_exists("entityid", $request["Destination"]) ' );
131
+ assert ('array_key_exists("entityid", $request["Destination"]) ' );
129
132
130
133
$ attributes =& $ request ['Attributes ' ];
131
134
132
135
if (!array_key_exists ($ this ->attribute , $ attributes )) {
133
- SimpleSAML_Logger ::info ('AttributeFromSQL: attribute \'' . $ this ->attribute . '\' not set, declining ' );
136
+ SimpleSAML \Logger ::info ('AttributeFromSQL: attribute \'' . $ this ->attribute . '\' not set, declining ' );
134
137
return ;
135
138
}
136
139
@@ -145,8 +148,8 @@ public function process(&$request)
145
148
try {
146
149
$ res = $ sth ->execute (array ($ attributes [$ this ->attribute ][0 ], $ request ["Destination " ]["entityid " ]));
147
150
} catch (PDOException $ e ) {
148
- throw new SimpleSAML_Error_Exception ('AttributeFromSQL: execute( ' . $ attributes [$ this ->attribute ][0 ] .
149
- ', ' . $ request ["Destination " ]["entityid " ] . ') failed: ' . $ e ->getMessage ());
151
+ throw new SimpleSAML_Error_Exception ('AttributeFromSQL: execute( ' . $ attributes [$ this ->attribute ][0 ] .
152
+ ', ' . $ request ["Destination " ]["entityid " ] . ') failed: ' . $ e ->getMessage ());
150
153
}
151
154
152
155
try {
@@ -157,7 +160,7 @@ public function process(&$request)
157
160
}
158
161
159
162
if (count ($ data ) === 0 ) {
160
- SimpleSAML_Logger ::info ('AttributeFromSQL: no additional attributes for ' . $ this ->attribute . '= \'' . $ attributes [$ this ->attribute ][0 ] . '\'' );
163
+ SimpleSAML \Logger ::info ('AttributeFromSQL: no additional attributes for ' . $ this ->attribute . '= \'' . $ attributes [$ this ->attribute ][0 ] . '\'' );
161
164
return ;
162
165
}
163
166
@@ -167,7 +170,7 @@ public function process(&$request)
167
170
*/
168
171
foreach ($ data as $ row ) {
169
172
if (empty ($ row ['attribute ' ]) || $ row ['value ' ] === null ) {
170
- SimpleSAML_Logger ::debug ('AttributeFromSQL: skipping invalid attribute/value tuple: ' . var_export ($ row , true ));
173
+ SimpleSAML \Logger ::debug ('AttributeFromSQL: skipping invalid attribute/value tuple: ' . var_export ($ row , true ));
171
174
continue ;
172
175
}
173
176
@@ -176,7 +179,7 @@ public function process(&$request)
176
179
177
180
/* Limit the attribute set returned */
178
181
if ($ this ->limit !== null && !in_array ($ name , $ this ->limit , true )) {
179
- SimpleSAML_Logger ::notice ('AttributeFromSQL: skipping unwanted attribute ' . $ name . ' [limited to: ' . var_export ($ this ->limit , true ) . '] ' );
182
+ SimpleSAML \Logger ::notice ('AttributeFromSQL: skipping unwanted attribute ' . $ name . ' [limited to: ' . var_export ($ this ->limit , true ) . '] ' );
180
183
continue ;
181
184
}
182
185
@@ -186,7 +189,7 @@ public function process(&$request)
186
189
187
190
if (in_array ($ value , $ attributes [$ name ], true )) {
188
191
/* Value already exists in attribute. */
189
- SimpleSAML_Logger ::debug ('AttributeFromSQL: skipping duplicate attribute/value tuple ' . $ name . '= \'' . $ value . '\'' );
192
+ SimpleSAML \Logger ::debug ('AttributeFromSQL: skipping duplicate attribute/value tuple ' . $ name . '= \'' . $ value . '\'' );
190
193
continue ;
191
194
}
192
195
0 commit comments