@@ -38,6 +38,7 @@ class sspmod_sqlattribs_Auth_Process_AttributeFromSQL extends SimpleSAML_Auth_Pr
3838 *
3939 * @param array $config Configuration information about this filter.
4040 * @param mixed $reserved For future use.
41+ * @throws SimpleSAML_Error_Exception
4142 */
4243 public function __construct ($ config , $ reserved )
4344 {
@@ -88,14 +89,15 @@ public function __construct($config, $reserved)
8889 * Create a database connection.
8990 *
9091 * @return PDO The database connection.
92+ * @throws SimpleSAML_Error_Exception
9193 */
9294 private function connect ()
9395 {
9496 try {
9597 $ db = new PDO ($ this ->dsn , $ this ->username , $ this ->password );
9698 } 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 ());
99101 }
100102 $ db ->setAttribute (PDO ::ATTR_ERRMODE , PDO ::ERRMODE_EXCEPTION );
101103
@@ -120,17 +122,18 @@ private function connect()
120122 *
121123 * Logic is largely the same as (and lifted from) sqlauth:sql
122124 * @param mixed &$request
125+ * @throws SimpleSAML_Error_Exception
123126 */
124127 public function process (&$ request )
125128 {
126129 assert ('is_array($request) ' );
127130 assert ('array_key_exists("Attributes", $request) ' );
128- assert ('array_key_exists("entityid", $request["Destination"]) ' );
131+ assert ('array_key_exists("entityid", $request["Destination"]) ' );
129132
130133 $ attributes =& $ request ['Attributes ' ];
131134
132135 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 ' );
134137 return ;
135138 }
136139
@@ -145,8 +148,8 @@ public function process(&$request)
145148 try {
146149 $ res = $ sth ->execute (array ($ attributes [$ this ->attribute ][0 ], $ request ["Destination " ]["entityid " ]));
147150 } 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 ());
150153 }
151154
152155 try {
@@ -157,7 +160,7 @@ public function process(&$request)
157160 }
158161
159162 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 ] . '\'' );
161164 return ;
162165 }
163166
@@ -167,7 +170,7 @@ public function process(&$request)
167170 */
168171 foreach ($ data as $ row ) {
169172 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 ));
171174 continue ;
172175 }
173176
@@ -176,7 +179,7 @@ public function process(&$request)
176179
177180 /* Limit the attribute set returned */
178181 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 ) . '] ' );
180183 continue ;
181184 }
182185
@@ -186,7 +189,7 @@ public function process(&$request)
186189
187190 if (in_array ($ value , $ attributes [$ name ], true )) {
188191 /* 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 . '\'' );
190193 continue ;
191194 }
192195
0 commit comments