From 0abfcf2ad35710999961bdebecf7983f099dea0b Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Wed, 22 Aug 2018 22:45:13 +0200 Subject: [PATCH] phpcs: PSR-2 --- lib/SimpleSAML/Auth/LDAP.php | 79 +++++++++++++------ lib/SimpleSAML/Auth/ProcessingChain.php | 18 +++-- lib/SimpleSAML/Auth/Source.php | 6 +- lib/SimpleSAML/AuthMemCookie.php | 3 +- lib/SimpleSAML/Bindings/Shib13/Artifact.php | 5 +- lib/SimpleSAML/Configuration.php | 7 +- lib/SimpleSAML/Memcache.php | 3 +- .../Metadata/MetaDataStorageHandlerPdo.php | 9 ++- .../MetaDataStorageHandlerSerialize.php | 3 +- .../Metadata/MetaDataStorageSource.php | 4 +- lib/SimpleSAML/Metadata/SAMLBuilder.php | 3 +- lib/SimpleSAML/Metadata/Signer.php | 3 +- lib/SimpleSAML/Utilities.php | 4 +- lib/SimpleSAML/Utils/Config/Metadata.php | 2 +- lib/SimpleSAML/XHTML/TemplateLoader.php | 4 +- lib/SimpleSAML/XML/Parser.php | 6 +- lib/SimpleSAML/XML/Shib13/AuthnRequest.php | 5 +- lib/SimpleSAML/XML/Shib13/AuthnResponse.php | 11 ++- 18 files changed, 119 insertions(+), 56 deletions(-) diff --git a/lib/SimpleSAML/Auth/LDAP.php b/lib/SimpleSAML/Auth/LDAP.php index 2e7bae494..1bd7299f2 100644 --- a/lib/SimpleSAML/Auth/LDAP.php +++ b/lib/SimpleSAML/Auth/LDAP.php @@ -60,8 +60,14 @@ class LDAP * @param int $port * @param bool $referrals */ - public function __construct($hostname, $enable_tls = true, $debug = false, $timeout = 0, $port = 389, $referrals = true) - { + public function __construct( + $hostname, + $enable_tls = true, + $debug = false, + $timeout = 0, + $port = 389, + $referrals = true + ) { // Debug Logger::debug('Library - LDAP __construct(): Setup LDAP with '. 'host=\''.$hostname. @@ -77,7 +83,7 @@ class LDAP * OpenLDAP 2.x.x or Netscape Directory SDK x.x needed for this option. */ if ($debug && !ldap_set_option(null, LDAP_OPT_DEBUG_LEVEL, 7)) { - Logger::warning('Library - LDAP __construct(): Unable to set debug level (LDAP_OPT_DEBUG_LEVEL) to 7'); + Logger::warning('Library - LDAP __construct(): Unable to set debug level (LDAP_OPT_DEBUG_LEVEL) to 7'); } /* @@ -86,18 +92,21 @@ class LDAP */ $resource = @ldap_connect($hostname, $port); if ($resource === false) { - throw $this->makeException('Library - LDAP __construct(): Unable to connect to \''.$hostname.'\'', ERR_INTERNAL); + throw $this->makeException('Library - LDAP __construct(): Unable to connect to \''. + $hostname.'\'', ERR_INTERNAL); } $this->ldap = $resource; // Enable LDAP protocol version 3 if (!@ldap_set_option($this->ldap, LDAP_OPT_PROTOCOL_VERSION, 3)) { - throw $this->makeException('Library - LDAP __construct(): Failed to set LDAP Protocol version (LDAP_OPT_PROTOCOL_VERSION) to 3', ERR_INTERNAL); + throw $this->makeException('Library - LDAP __construct(): Failed to set LDAP Protocol'. + ' version (LDAP_OPT_PROTOCOL_VERSION) to 3', ERR_INTERNAL); } // Set referral option if (!@ldap_set_option($this->ldap, LDAP_OPT_REFERRALS, $referrals)) { - throw $this->makeException('Library - LDAP __construct(): Failed to set LDAP Referrals (LDAP_OPT_REFERRALS) to '.$referrals, ERR_INTERNAL); + throw $this->makeException('Library - LDAP __construct(): Failed to set LDAP Referrals'. + ' (LDAP_OPT_REFERRALS) to '.$referrals, ERR_INTERNAL); } // Set timeouts, if supported @@ -105,17 +114,20 @@ class LDAP $this->timeout = $timeout; if ($timeout > 0) { if (!@ldap_set_option($this->ldap, LDAP_OPT_NETWORK_TIMEOUT, $timeout)) { - Logger::warning('Library - LDAP __construct(): Unable to set timeouts (LDAP_OPT_NETWORK_TIMEOUT) to '.$timeout); + Logger::warning('Library - LDAP __construct(): Unable to set timeouts'. + ' (LDAP_OPT_NETWORK_TIMEOUT) to '.$timeout); } if (!@ldap_set_option($this->ldap, LDAP_OPT_TIMELIMIT, $timeout)) { - Logger::warning('Library - LDAP __construct(): Unable to set timeouts (LDAP_OPT_TIMELIMIT) to '.$timeout); + Logger::warning('Library - LDAP __construct(): Unable to set timeouts'. + ' (LDAP_OPT_TIMELIMIT) to '.$timeout); } } // Enable TLS, if needed if (stripos($hostname, "ldaps:") === false && $enable_tls) { if (!@ldap_start_tls($this->ldap)) { - throw $this->makeException('Library - LDAP __construct(): Unable to force TLS', ERR_INTERNAL); + throw $this->makeException('Library - LDAP __construct():'. + ' Unable to force TLS', ERR_INTERNAL); } } } @@ -164,7 +176,9 @@ class LDAP } else { if ($errNo !== 0) { $description .= '; cause: \''.ldap_error($this->ldap).'\' (0x'.dechex($errNo).')'; - if (@ldap_get_option($this->ldap, LDAP_OPT_DIAGNOSTIC_MESSAGE, $extendedError) && !empty($extendedError)) { + if (@ldap_get_option($this->ldap, LDAP_OPT_DIAGNOSTIC_MESSAGE, $extendedError) + && !empty($extendedError) + ) { $description .= '; additional: \''.$extendedError.'\''; } } @@ -233,14 +247,15 @@ class LDAP Logger::debug('Library - LDAP search(): Searching base ('.$scope.') \''.$base.'\' for \''.$filter.'\''); if ($scope === 'base') { $result = @ldap_read($this->ldap, $base, $filter, array(), 0, 0, $this->timeout, LDAP_DEREF_NEVER); - } else if ($scope === 'onelevel') { + } elseif ($scope === 'onelevel') { $result = @ldap_list($this->ldap, $base, $filter, array(), 0, 0, $this->timeout, LDAP_DEREF_NEVER); } else { $result = @ldap_search($this->ldap, $base, $filter, array(), 0, 0, $this->timeout, LDAP_DEREF_NEVER); } if ($result === false) { - throw $this->makeException('Library - LDAP search(): Failed search on base \''.$base.'\' for \''.$filter.'\''); + throw $this->makeException('Library - LDAP search(): Failed search on base \''. + $base.'\' for \''.$filter.'\''); } // Sanity checks on search results @@ -249,21 +264,25 @@ class LDAP throw $this->makeException('Library - LDAP search(): Failed to get number of entries returned'); } elseif ($count > 1) { // More than one entry is found. External error - throw $this->makeException('Library - LDAP search(): Found '.$count.' entries searching base \''.$base.'\' for \''.$filter.'\'', ERR_AS_DATA_INCONSIST); + throw $this->makeException('Library - LDAP search(): Found '.$count.' entries searching base \''. + $base.'\' for \''.$filter.'\'', ERR_AS_DATA_INCONSIST); } elseif ($count === 0) { // No entry is fond => wrong username is given (or not registered in the catalogue). User error - throw $this->makeException('Library - LDAP search(): Found no entries searching base \''.$base.'\' for \''.$filter.'\'', ERR_NO_USER); + throw $this->makeException('Library - LDAP search(): Found no entries searching base \''. + $base.'\' for \''.$filter.'\'', ERR_NO_USER); } // Resolve the DN from the search result $entry = @ldap_first_entry($this->ldap, $result); if ($entry === false) { - throw $this->makeException('Library - LDAP search(): Unable to retrieve result after searching base \''.$base.'\' for \''.$filter.'\''); + throw $this->makeException('Library - LDAP search(): Unable to retrieve result after searching base \''. + $base.'\' for \''.$filter.'\''); } $dn = @ldap_get_dn($this->ldap, $entry); if ($dn === false) { - throw $this->makeException('Library - LDAP search(): Unable to get DN after searching base \''.$base.'\' for \''.$filter.'\''); + throw $this->makeException('Library - LDAP search(): Unable to get DN after searching base \''. + $base.'\' for \''.$filter.'\''); } return $dn; } @@ -296,8 +315,14 @@ class LDAP * - $allowZeroHits is FALSE and no result is found * */ - public function searchfordn($base, $attribute, $value, $allowZeroHits = false, $searchFilter = null, $scope = 'subtree') - { + public function searchfordn( + $base, + $attribute, + $value, + $allowZeroHits = false, + $searchFilter = null, + $scope = 'subtree' + ) { // Traverse all search bases, returning DN if found $bases = \SimpleSAML\Utils\Arrays::arrayize($base); foreach ($bases as $current) { @@ -321,8 +346,8 @@ class LDAP return null; } else { // Zero hits not allowed - throw $this->makeException('Library - LDAP searchfordn(): LDAP search returned zero entries for filter \'('. - join(' | ', $attribute).' = '.$value.')\' on base(s) \'('.join(' & ', $bases).')\'', 2); + throw $this->makeException('Library - LDAP searchfordn(): LDAP search returned zero entries for'. + ' filter \'('.join(' | ', $attribute).' = '.$value.')\' on base(s) \'('.join(' & ', $bases).')\'', 2); } } @@ -340,8 +365,14 @@ class LDAP * @param string $scope The scope of the search * @return array */ - public function searchformultiple($bases, $filters, $attributes = array(), $and = true, $escape = true, $scope = 'subtree') - { + public function searchformultiple( + $bases, + $filters, + $attributes = array(), + $and = true, + $escape = true, + $scope = 'subtree' + ) { // Escape the filter values, if requested if ($escape) { $filters = $this->escape_filter_value($filters, false); @@ -728,7 +759,7 @@ class LDAP /** * Convert SASL authz_id into a DN */ - private function authzid_to_dn($searchBase, $searchAttributes, $authz_id) + private function authzidToDn($searchBase, $searchAttributes, $authz_id) { if (preg_match("/^dn:/", $authz_id)) { return preg_replace("/^dn:/", "", $authz_id); @@ -773,7 +804,7 @@ class LDAP $authz_id = $this->authz_id; } - $dn = $this->authzid_to_dn($searchBase, $searchAttributes, $authz_id); + $dn = $this->authzidToDn($searchBase, $searchAttributes, $authz_id); if (!isset($dn) || ($dn == '')) { throw $this->makeException('Cannot figure userID'); diff --git a/lib/SimpleSAML/Auth/ProcessingChain.php b/lib/SimpleSAML/Auth/ProcessingChain.php index 2b1aa72d2..b265ccd08 100644 --- a/lib/SimpleSAML/Auth/ProcessingChain.php +++ b/lib/SimpleSAML/Auth/ProcessingChain.php @@ -151,7 +151,11 @@ class ProcessingChain throw new \Exception('Authentication processing filter without name given.'); } - $className = \SimpleSAML\Module::resolveClass($config['class'], 'Auth_Process', '\SimpleSAML\Auth\ProcessingFilter'); + $className = \SimpleSAML\Module::resolveClass( + $config['class'], + 'Auth_Process', + '\SimpleSAML\Auth\ProcessingFilter' + ); $config['%priority'] = $priority; unset($config['class']); return new $className($config, null); @@ -202,9 +206,9 @@ class ProcessingChain throw $e; } catch (\Exception $e) { /* - * To be consistent with the exception we return after an redirect, - * we convert this exception before returning it. - */ + * To be consistent with the exception we return after an redirect, + * we convert this exception before returning it. + */ throw new \SimpleSAML\Error\UnserializableException($e); } @@ -247,9 +251,9 @@ class ProcessingChain if (array_key_exists('ReturnURL', $state)) { /* - * Save state information, and redirect to the URL specified - * in $state['ReturnURL']. - */ + * Save state information, and redirect to the URL specified + * in $state['ReturnURL']. + */ $id = State::saveState($state, self::COMPLETED_STAGE); \SimpleSAML\Utils\HTTP::redirectTrustedURL($state['ReturnURL'], array(self::AUTHPARAM => $id)); } else { diff --git a/lib/SimpleSAML/Auth/Source.php b/lib/SimpleSAML/Auth/Source.php index 4569eae3c..a7dc11633 100644 --- a/lib/SimpleSAML/Auth/Source.php +++ b/lib/SimpleSAML/Auth/Source.php @@ -304,7 +304,11 @@ abstract class Source try { // Check whether or not there's a factory responsible for instantiating our Auth Source instance - $factoryClass = \SimpleSAML\Module::resolveClass($id, 'Auth_Source_Factory', '\SimpleSAML\Auth\SourceFactory'); + $factoryClass = \SimpleSAML\Module::resolveClass( + $id, + 'Auth_Source_Factory', + '\SimpleSAML\Auth\SourceFactory' + ); /** @var SourceFactory $factory */ $factory = new $factoryClass; diff --git a/lib/SimpleSAML/AuthMemCookie.php b/lib/SimpleSAML/AuthMemCookie.php index 1c5fb7c96..da3b22f8f 100644 --- a/lib/SimpleSAML/AuthMemCookie.php +++ b/lib/SimpleSAML/AuthMemCookie.php @@ -120,7 +120,8 @@ class AuthMemCookie $class = class_exists('Memcache') ? '\Memcache' : (class_exists('Memcached') ? '\Memcached' : false); if (!$class) { - throw new \Exception('Missing Memcached implementation. You must install either the Memcache or Memcached extension.'); + throw new \Exception('Missing Memcached implementation.'. + ' You must install either the Memcache or Memcached extension.'); } // Create the Memcache(d) object. diff --git a/lib/SimpleSAML/Bindings/Shib13/Artifact.php b/lib/SimpleSAML/Bindings/Shib13/Artifact.php index de15f364d..83df98925 100644 --- a/lib/SimpleSAML/Bindings/Shib13/Artifact.php +++ b/lib/SimpleSAML/Bindings/Shib13/Artifact.php @@ -140,7 +140,10 @@ class Artifact XML::debugSAMLMessage($request, 'out'); - $url = $idpMetadata->getDefaultEndpoint('ArtifactResolutionService', array('urn:oasis:names:tc:SAML:1.0:bindings:SOAP-binding')); + $url = $idpMetadata->getDefaultEndpoint( + 'ArtifactResolutionService', + array('urn:oasis:names:tc:SAML:1.0:bindings:SOAP-binding') + ); $url = $url['Location']; $peerPublicKeys = $idpMetadata->getPublicKeys('signing', true); diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php index 7b0ad4543..48dc325c5 100644 --- a/lib/SimpleSAML/Configuration.php +++ b/lib/SimpleSAML/Configuration.php @@ -207,8 +207,11 @@ class Configuration implements Utils\ClearableState * @param string $filename The name of the configuration file. * @param string $configSet The configuration set. Optional, defaults to 'simplesaml'. */ - public static function setPreLoadedConfig(Configuration $config, $filename = 'config.php', $configSet = 'simplesaml') - { + public static function setPreLoadedConfig( + Configuration $config, + $filename = 'config.php', + $configSet = 'simplesaml' + ) { assert(is_string($filename)); assert(is_string($configSet)); diff --git a/lib/SimpleSAML/Memcache.php b/lib/SimpleSAML/Memcache.php index 1752e149e..d0288d9f3 100644 --- a/lib/SimpleSAML/Memcache.php +++ b/lib/SimpleSAML/Memcache.php @@ -306,7 +306,8 @@ class Memcache { $class = class_exists('\Memcache') ? '\Memcache' : (class_exists('\Memcached') ? '\Memcached' : false); if (!$class) { - throw new \Exception('Missing Memcached implementation. You must install either the Memcache or Memcached extension.'); + throw new \Exception('Missing Memcached implementation.'. + ' You must install either the Memcache or Memcached extension.'); } self::$extension = strtolower($class); diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php index f6f5cdb46..e5d182764 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php @@ -142,9 +142,9 @@ class MetaDataStorageHandlerPdo extends MetaDataStorageSource return $metadataSet; } - /** + /** * Retrieve a metadata entry. - * + * * @param string $entityId The entityId we are looking up. * @param string $set The set we are looking for metadata in. * @@ -162,7 +162,10 @@ class MetaDataStorageHandlerPdo extends MetaDataStorageSource return null; } - $stmt = $this->db->read("SELECT entity_id, entity_data FROM $tableName WHERE entity_id=:entityId", array('entityId' => $entityId)); + $stmt = $this->db->read( + "SELECT entity_id, entity_data FROM $tableName WHERE entity_id=:entityId", + array('entityId' => $entityId) + ); if ($stmt->execute()) { $rowCount = 0; $data = null; diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php index 7b9d478f5..c1c7e6853 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php @@ -130,7 +130,8 @@ class MetaDataStorageHandlerSerialize extends MetaDataStorageSource $dh = @opendir($dir); if ($dh === false) { - \SimpleSAML\Logger::warning('Serialize metadata handler: Unable to open directory: '.var_export($dir, true)); + \SimpleSAML\Logger::warning('Serialize metadata handler: Unable to open directory: '. + var_export($dir, true)); return $ret; } diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageSource.php b/lib/SimpleSAML/Metadata/MetaDataStorageSource.php index 360b619ce..c692b4a70 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageSource.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageSource.php @@ -184,8 +184,8 @@ abstract class MetaDataStorageSource } // support discohints in idp metadata for idp discovery - if (array_key_exists('DiscoHints', $entry) - && array_key_exists('IPHint', $entry['DiscoHints']) + if (array_key_exists('DiscoHints', $entry) + && array_key_exists('IPHint', $entry['DiscoHints']) && is_array($entry['DiscoHints']['IPHint'])) { // merge with hints derived from discohints, but prioritize hint.cidr in case it is used $cidrHints = array_merge($entry['DiscoHints']['IPHint'], $cidrHints); diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php index 0c6c7869b..48e1f9454 100644 --- a/lib/SimpleSAML/Metadata/SAMLBuilder.php +++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php @@ -321,7 +321,8 @@ class SAMLBuilder * @param array $endpoints The endpoints. * @param bool $indexed Whether the endpoints should be indexed. * - * @return array An array of endpoint objects, either \SAML2\XML\md\EndpointType or \SAML2\XML\md\IndexedEndpointType. + * @return array An array of endpoint objects, + * either \SAML2\XML\md\EndpointType or \SAML2\XML\md\IndexedEndpointType. */ private static function createEndpoints(array $endpoints, $indexed) { diff --git a/lib/SimpleSAML/Metadata/Signer.php b/lib/SimpleSAML/Metadata/Signer.php index eb87586ac..195cb02c5 100644 --- a/lib/SimpleSAML/Metadata/Signer.php +++ b/lib/SimpleSAML/Metadata/Signer.php @@ -229,7 +229,8 @@ class Signer $keyFile = \SimpleSAML\Utils\Config::getCertPath($keyCertFiles['privatekey']); if (!file_exists($keyFile)) { - throw new \Exception('Could not find private key file ['.$keyFile.'], which is needed to sign the metadata'); + throw new \Exception('Could not find private key file ['. + $keyFile.'], which is needed to sign the metadata'); } $keyData = file_get_contents($keyFile); diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php index d253408f1..0a830bb44 100644 --- a/lib/SimpleSAML/Utilities.php +++ b/lib/SimpleSAML/Utilities.php @@ -191,7 +191,7 @@ class Utilities } - private static function _doRedirect($url, $parameters = array()) + private static function doRedirect($url, $parameters = array()) { assert(is_string($url)); assert(!empty($url)); @@ -264,7 +264,7 @@ class Utilities } else { $url = self::normalizeURL($url); } - self::_doRedirect($url, $parameters); + self::doRedirect($url, $parameters); } diff --git a/lib/SimpleSAML/Utils/Config/Metadata.php b/lib/SimpleSAML/Utils/Config/Metadata.php index 88704151d..5cecde300 100644 --- a/lib/SimpleSAML/Utils/Config/Metadata.php +++ b/lib/SimpleSAML/Utils/Config/Metadata.php @@ -106,7 +106,7 @@ class Metadata // check the type if (!isset($contact['contactType']) || !in_array($contact['contactType'], self::$VALID_CONTACT_TYPES, true)) { $types = join(', ', array_map( - function($t) { + function ($t) { return '"'.$t.'"'; }, self::$VALID_CONTACT_TYPES diff --git a/lib/SimpleSAML/XHTML/TemplateLoader.php b/lib/SimpleSAML/XHTML/TemplateLoader.php index d3a9f853c..7c0ff97e9 100644 --- a/lib/SimpleSAML/XHTML/TemplateLoader.php +++ b/lib/SimpleSAML/XHTML/TemplateLoader.php @@ -58,8 +58,8 @@ class TemplateLoader extends \Twig\Loader\FilesystemLoader $templatedir = $moduledir.'/templates'; if (!is_dir($templatedir)) { throw new \InvalidArgumentException('The module \''.$module.'\' has no templates directory.'); - } return $templatedir; } -} \ No newline at end of file +} + diff --git a/lib/SimpleSAML/XML/Parser.php b/lib/SimpleSAML/XML/Parser.php index b71a87362..eaf530b64 100644 --- a/lib/SimpleSAML/XML/Parser.php +++ b/lib/SimpleSAML/XML/Parser.php @@ -52,7 +52,8 @@ class Parser $result = $this->simplexml->xpath($xpath); if (!is_array($result) || empty($result)) { if ($required) { - throw new \Exception('Could not get value from XML document using the following XPath expression: '.$xpath); + throw new \Exception('Could not get value from XML document'. + ' using the following XPath expression: '.$xpath); } else { return null; } @@ -69,7 +70,8 @@ class Parser } } if ($required) { - throw new \Exception('Could not get value from XML document using multiple alternative XPath expressions.'); + throw new \Exception('Could not get value from XML document'. + ' using multiple alternative XPath expressions.'); } else { return null; } diff --git a/lib/SimpleSAML/XML/Shib13/AuthnRequest.php b/lib/SimpleSAML/XML/Shib13/AuthnRequest.php index 717e2ff6a..6c4fe7c7b 100644 --- a/lib/SimpleSAML/XML/Shib13/AuthnRequest.php +++ b/lib/SimpleSAML/XML/Shib13/AuthnRequest.php @@ -39,7 +39,10 @@ class AuthnRequest $metadata = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler(); $idpmetadata = $metadata->getMetaDataConfig($destination, 'shib13-idp-remote'); - $desturl = $idpmetadata->getDefaultEndpoint('SingleSignOnService', array('urn:mace:shibboleth:1.0:profiles:AuthnRequest')); + $desturl = $idpmetadata->getDefaultEndpoint( + 'SingleSignOnService', + array('urn:mace:shibboleth:1.0:profiles:AuthnRequest') + ); $desturl = $desturl['Location']; $target = $this->getRelayState(); diff --git a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php index d10c91fc9..6c8b7e62f 100644 --- a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php +++ b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php @@ -119,7 +119,8 @@ class AuthnResponse // Validate against CA $this->validator->validateCA(Config::getCertPath($md->getString('caFile'))); } else { - throw new \SimpleSAML\Error\Exception('Missing certificate in Shibboleth 1.3 IdP Remote metadata for identity provider ['.$issuer.'].'); + throw new \SimpleSAML\Error\Exception('Missing certificate in Shibboleth 1.3'. + ' IdP Remote metadata for identity provider ['.$issuer.'].'); } return true; @@ -233,7 +234,10 @@ class AuthnResponse } } - $attribute_nodes = $this->doXPathQuery('shib:AttributeStatement/shib:Attribute/shib:AttributeValue', $assertion); + $attribute_nodes = $this->doXPathQuery( + 'shib:AttributeStatement/shib:Attribute/shib:AttributeValue', + $assertion + ); /** @var \DOMElement $attribute */ foreach ($attribute_nodes as $attribute) { $value = $attribute->textContent; @@ -418,7 +422,8 @@ class AuthnResponse $scoped = false; } - $attr = '<Attribute AttributeName="'.htmlspecialchars($name).'" AttributeNamespace="urn:mace:shibboleth:1.0:attributeNamespace:uri">'; + $attr = '<Attribute AttributeName="'.htmlspecialchars($name). + '" AttributeNamespace="urn:mace:shibboleth:1.0:attributeNamespace:uri">'; foreach ($values as $value) { $scopePart = ''; if ($scoped) { -- GitLab