- if (isset($this->credentials[$host])) {
- $parameters['username'] = $this->credentials[$host]['username'];
- $parameters['password'] = $this->credentials[$host]['password'];
+ $config = new SiteConfig($parameters);
+
+ // do not leak usernames and passwords in log
+ $parameters['username'] = '**masked**';
+ $parameters['password'] = '**masked**';
+
+ $this->logger->debug('Auth: add parameters.', ['host' => $host, 'parameters' => $parameters]);
+
+ return $config;
+ }
+
+ /**
+ * Processes login_extra_fields config, transforming an '=' separated array of strings
+ * into a key/value array.
+ *
+ * @param array|mixed $extraFieldsStrings
+ *
+ * @return array
+ */
+ protected function processExtraFields($extraFieldsStrings)
+ {
+ if (!\is_array($extraFieldsStrings)) {
+ return [];
+ }
+
+ $extraFields = [];
+ foreach ($extraFieldsStrings as $extraField) {
+ if (false === strpos($extraField, '=')) {
+ continue;
+ }
+
+ list($fieldName, $fieldValue) = explode('=', $extraField, 2);
+ $extraFields[$fieldName] = $fieldValue;