Completed
Branch release-4.x (14fafb)
by Tim
06:22 queued 01:59
created
src/SAML2/HTTPArtifact.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
         if ($issuer === null) {
48 48
             throw new \Exception('Cannot get redirect URL, no Issuer set in the message.');
49 49
         }
50
-        $artifact = base64_encode("\x00\x04\x00\x00".sha1($issuer->getValue(), true).$generatedId);
50
+        $artifact = base64_encode("\x00\x04\x00\x00" . sha1($issuer->getValue(), true) . $generatedId);
51 51
         $artifactData = $message->toUnsignedXML();
52 52
         $artifactDataString = $artifactData->ownerDocument->saveXML($artifactData);
53 53
 
54
-        $store->set('artifact', $artifact, $artifactDataString, Temporal::getTime() + 15*60);
54
+        $store->set('artifact', $artifact, $artifactDataString, Temporal::getTime() + 15 * 60);
55 55
 
56 56
         $params = [
57 57
             'SAMLart' => $artifact,
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         $idpMetadata = $metadataHandler->getMetaDataConfigForSha1($sourceId, 'saml20-idp-remote');
110 110
 
111 111
         if ($idpMetadata === null) {
112
-            throw new \Exception('No metadata found for remote provider with SHA1 ID: '.var_export($sourceId, true));
112
+            throw new \Exception('No metadata found for remote provider with SHA1 ID: ' . var_export($sourceId, true));
113 113
         }
114 114
 
115 115
         $endpoint = null;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             throw new \Exception('No ArtifactResolutionService with the correct index.');
125 125
         }
126 126
 
127
-        Utils::getContainer()->getLogger()->debug("ArtifactResolutionService endpoint being used is := ".$endpoint['Location']);
127
+        Utils::getContainer()->getLogger()->debug("ArtifactResolutionService endpoint being used is := " . $endpoint['Location']);
128 128
 
129 129
         //Construct the ArtifactResolve Request
130 130
         $ar = new ArtifactResolve();
Please login to merge, or discard this patch.
src/SAML2/HTTPRedirect.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -55,21 +55,21 @@  discard block
 block discarded – undo
55 55
         $msg .= urlencode($msgStr);
56 56
 
57 57
         if ($relayState !== null) {
58
-            $msg .= '&RelayState='.urlencode($relayState);
58
+            $msg .= '&RelayState=' . urlencode($relayState);
59 59
         }
60 60
 
61 61
         if ($key !== null) { // add the signature
62 62
             /** @psalm-suppress PossiblyInvalidArgument */
63
-            $msg .= '&SigAlg='.urlencode($key->type);
63
+            $msg .= '&SigAlg=' . urlencode($key->type);
64 64
 
65 65
             $signature = $key->signData($msg);
66
-            $msg .= '&Signature='.urlencode(base64_encode($signature));
66
+            $msg .= '&Signature=' . urlencode(base64_encode($signature));
67 67
         }
68 68
 
69 69
         if (strpos($destination, '?') === false) {
70
-            $destination .= '?'.$msg;
70
+            $destination .= '?' . $msg;
71 71
         } else {
72
-            $destination .= '&'.$msg;
72
+            $destination .= '&' . $msg;
73 73
         }
74 74
 
75 75
         return $destination;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     public function send(Message $message) : void
87 87
     {
88 88
         $destination = $this->getRedirectURL($message);
89
-        Utils::getContainer()->getLogger()->debug('Redirect to '.strlen($destination).' byte URL: '.$destination);
89
+        Utils::getContainer()->getLogger()->debug('Redirect to ' . strlen($destination) . ' byte URL: ' . $destination);
90 90
         Utils::getContainer()->redirect($destination);
91 91
     }
92 92
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         }
114 114
 
115 115
         if (isset($data['SAMLEncoding']) && $data['SAMLEncoding'] !== self::DEFLATE) {
116
-            throw new \Exception('Unknown SAMLEncoding: '.var_export($data['SAMLEncoding'], true));
116
+            throw new \Exception('Unknown SAMLEncoding: ' . var_export($data['SAMLEncoding'], true));
117 117
         }
118 118
 
119 119
         $message = base64_decode($message);
@@ -192,18 +192,18 @@  discard block
 block discarded – undo
192 192
             switch ($name) {
193 193
                 case 'SAMLRequest':
194 194
                 case 'SAMLResponse':
195
-                    $sigQuery = $name.'='.$value;
195
+                    $sigQuery = $name . '=' . $value;
196 196
                     break;
197 197
                 case 'RelayState':
198
-                    $relayState = '&RelayState='.$value;
198
+                    $relayState = '&RelayState=' . $value;
199 199
                     break;
200 200
                 case 'SigAlg':
201
-                    $sigAlg = '&SigAlg='.$value;
201
+                    $sigAlg = '&SigAlg=' . $value;
202 202
                     break;
203 203
             }
204 204
         }
205 205
 
206
-        $data['SignedQuery'] = $sigQuery.$relayState.$sigAlg;
206
+        $data['SignedQuery'] = $sigQuery . $relayState . $sigAlg;
207 207
 
208 208
         return $data;
209 209
     }
Please login to merge, or discard this patch.
src/SAML2/Utils.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
         }
272 272
 
273 273
         foreach ($namespaces as $prefix => $uri) {
274
-            $newElement->setAttributeNS($uri, $prefix.':__ns_workaround__', 'tmp');
274
+            $newElement->setAttributeNS($uri, $prefix . ':__ns_workaround__', 'tmp');
275 275
             $newElement->removeAttributeNS($uri, '__ns_workaround__');
276 276
         }
277 277
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
             case 'true':
302 302
                 return true;
303 303
             default:
304
-                throw new \Exception('Invalid value of boolean attribute '.var_export($attributeName, true).': '.
304
+                throw new \Exception('Invalid value of boolean attribute ' . var_export($attributeName, true) . ': ' .
305 305
                     var_export($value, true));
306 306
         }
307 307
     }
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
             $symKeyInfoAlgo = $symmetricKeyInfo->getAlgorithm();
390 390
 
391 391
             if (in_array($symKeyInfoAlgo, $blacklist, true)) {
392
-                throw new \Exception('Algorithm disabled: '.var_export($symKeyInfoAlgo, true));
392
+                throw new \Exception('Algorithm disabled: ' . var_export($symKeyInfoAlgo, true));
393 393
             }
394 394
 
395 395
             if ($symKeyInfoAlgo === XMLSecurityKey::RSA_OAEP_MGF1P && $inputKeyAlgo === XMLSecurityKey::RSA_1_5) {
@@ -405,9 +405,9 @@  discard block
 block discarded – undo
405 405
             /* Make sure that the input key format is the same as the one used to encrypt the key. */
406 406
             if ($inputKeyAlgo !== $symKeyInfoAlgo) {
407 407
                 throw new \Exception(
408
-                    'Algorithm mismatch between input key and key used to encrypt '.
409
-                    ' the symmetric key for the message. Key was: '.
410
-                    var_export($inputKeyAlgo, true).'; message was: '.
408
+                    'Algorithm mismatch between input key and key used to encrypt ' .
409
+                    ' the symmetric key for the message. Key was: ' .
410
+                    var_export($inputKeyAlgo, true) . '; message was: ' .
411 411
                     var_export($symKeyInfoAlgo, true)
412 412
                 );
413 413
             }
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
                  * symmetric key, and for that we need to know the key size.
423 423
                  */
424 424
                 throw new \Exception(
425
-                    'Unknown key size for encryption algorithm: '.var_export($symmetricKey->type, true)
425
+                    'Unknown key size for encryption algorithm: ' . var_export($symmetricKey->type, true)
426 426
                 );
427 427
             }
428 428
 
@@ -434,13 +434,13 @@  discard block
 block discarded – undo
434 434
                 $key = $encKey->decryptKey($symmetricKeyInfo);
435 435
                 if (strlen($key) !== $keySize) {
436 436
                     throw new \Exception(
437
-                        'Unexpected key size ('.strval(strlen($key)*8).'bits) for encryption algorithm: '.
437
+                        'Unexpected key size (' . strval(strlen($key) * 8) . 'bits) for encryption algorithm: ' .
438 438
                         var_export($symmetricKey->type, true)
439 439
                     );
440 440
                 }
441 441
             } catch (\Exception $e) {
442 442
                 /* We failed to decrypt this key. Log it, and substitute a "random" key. */
443
-                Utils::getContainer()->getLogger()->error('Failed to decrypt symmetric key: '.$e->getMessage());
443
+                Utils::getContainer()->getLogger()->error('Failed to decrypt symmetric key: ' . $e->getMessage());
444 444
                 /* Create a replacement key, so that it looks like we fail in the same way as if the key was correctly
445 445
                  * padded. */
446 446
 
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
                 /** @psalm-suppress PossiblyNullArgument */
456 456
                 $pkey = openssl_pkey_get_details($symmetricKeyInfo->key);
457 457
                 $pkey = sha1(serialize($pkey), true);
458
-                $key = sha1($encryptedKey.$pkey, true);
458
+                $key = sha1($encryptedKey . $pkey, true);
459 459
 
460 460
                 /* Make sure that the key has the correct length. */
461 461
                 if (strlen($key) > $keySize) {
@@ -470,8 +470,8 @@  discard block
 block discarded – undo
470 470
             /* Make sure that the input key has the correct format. */
471 471
             if ($inputKeyAlgo !== $symKeyAlgo) {
472 472
                 throw new \Exception(
473
-                    'Algorithm mismatch between input key and key in message. '.
474
-                    'Key was: '.var_export($inputKeyAlgo, true).'; message was: '.
473
+                    'Algorithm mismatch between input key and key in message. ' .
474
+                    'Key was: ' . var_export($inputKeyAlgo, true) . '; message was: ' .
475 475
                     var_export($symKeyAlgo, true)
476 476
                 );
477 477
             }
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 
481 481
         $algorithm = $symmetricKey->getAlgorithm();
482 482
         if (in_array($algorithm, $blacklist, true)) {
483
-            throw new \Exception('Algorithm disabled: '.var_export($algorithm, true));
483
+            throw new \Exception('Algorithm disabled: ' . var_export($algorithm, true));
484 484
         }
485 485
 
486 486
         /**
@@ -494,9 +494,9 @@  discard block
 block discarded – undo
494 494
          * tree was serialized for encryption. In that case, we may miss the
495 495
          * namespaces needed to parse the XML.
496 496
          */
497
-        $xml = '<root xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" '.
498
-                        'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.
499
-            $decrypted.
497
+        $xml = '<root xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ' .
498
+                        'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' .
499
+            $decrypted .
500 500
             '</root>';
501 501
 
502 502
         try {
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
              * Something went wrong during decryption, but for security
534 534
              * reasons we cannot tell the user what failed.
535 535
              */
536
-            Utils::getContainer()->getLogger()->error('Decryption failed: '.$e->getMessage());
536
+            Utils::getContainer()->getLogger()->error('Decryption failed: ' . $e->getMessage());
537 537
             throw new \Exception('Failed to decrypt XML element.', 0, $e);
538 538
         }
539 539
     }
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
         $regex = '/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.\\d{1,9})?Z$/D';
698 698
         if (preg_match($regex, $time, $matches) == 0) {
699 699
             throw new \Exception(
700
-                'Invalid SAML2 timestamp passed to xsDateTimeToTimestamp: '.$time
700
+                'Invalid SAML2 timestamp passed to xsDateTimeToTimestamp: ' . $time
701 701
             );
702 702
         }
703 703
 
Please login to merge, or discard this patch.
src/SAML2/Message.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
         if ($xml->getAttribute('Version') !== '2.0') {
158 158
             /* Currently a very strict check. */
159
-            throw new \Exception('Unsupported version: '.$xml->getAttribute('Version'));
159
+            throw new \Exception('Unsupported version: ' . $xml->getAttribute('Version'));
160 160
         }
161 161
 
162 162
         $this->issueInstant = Utils::xsDateTimeToTimestamp($xml->getAttribute('IssueInstant'));
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
     {
438 438
         $this->document = DOMDocumentFactory::create();
439 439
 
440
-        $root = $this->document->createElementNS(Constants::NS_SAMLP, 'samlp:'.$this->tagName);
440
+        $root = $this->document->createElementNS(Constants::NS_SAMLP, 'samlp:' . $this->tagName);
441 441
         $this->document->appendChild($root);
442 442
 
443 443
         /* Ugly hack to add another namespace declaration to the root element. */
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
     public static function fromXML(\DOMElement $xml) : Message
561 561
     {
562 562
         if ($xml->namespaceURI !== Constants::NS_SAMLP) {
563
-            throw new \Exception('Unknown namespace of SAML message: '.var_export($xml->namespaceURI, true));
563
+            throw new \Exception('Unknown namespace of SAML message: ' . var_export($xml->namespaceURI, true));
564 564
         }
565 565
 
566 566
         switch ($xml->localName) {
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
             case 'ArtifactResolve':
580 580
                 return new ArtifactResolve($xml);
581 581
             default:
582
-                throw new \Exception('Unknown SAML message: '.var_export($xml->localName, true));
582
+                throw new \Exception('Unknown SAML message: ' . var_export($xml->localName, true));
583 583
         }
584 584
     }
585 585
 
Please login to merge, or discard this patch.
src/SAML2/Binding.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             case Constants::BINDING_PAOS:
47 47
                 return new SOAP();
48 48
             default:
49
-                throw new \Exception('Unsupported binding: '.var_export($urn, true));
49
+                throw new \Exception('Unsupported binding: ' . var_export($urn, true));
50 50
         }
51 51
     }
52 52
 
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
 
94 94
         $logger = Utils::getContainer()->getLogger();
95 95
         $logger->warning('Unable to find the SAML 2 binding used for this request.');
96
-        $logger->warning('Request method: '.var_export($_SERVER['REQUEST_METHOD'], true));
96
+        $logger->warning('Request method: ' . var_export($_SERVER['REQUEST_METHOD'], true));
97 97
         if (!empty($_GET)) {
98
-            $logger->warning("GET parameters: '".implode("', '", array_map('addslashes', array_keys($_GET)))."'");
98
+            $logger->warning("GET parameters: '" . implode("', '", array_map('addslashes', array_keys($_GET))) . "'");
99 99
         }
100 100
         if (!empty($_POST)) {
101
-            $logger->warning("POST parameters: '".implode("', '", array_map('addslashes', array_keys($_POST)))."'");
101
+            $logger->warning("POST parameters: '" . implode("', '", array_map('addslashes', array_keys($_POST))) . "'");
102 102
         }
103 103
         if (isset($_SERVER['CONTENT_TYPE'])) {
104
-            $logger->warning('Content-Type: '.var_export($_SERVER['CONTENT_TYPE'], true));
104
+            $logger->warning('Content-Type: ' . var_export($_SERVER['CONTENT_TYPE'], true));
105 105
         }
106 106
 
107 107
         throw new \Exception('Unable to find the SAML 2 binding used for this request.');
Please login to merge, or discard this patch.
src/SAML2/XML/md/ContactPerson.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      */
121 121
     private static function getStringElements(\DOMElement $parent, string $name) : array
122 122
     {
123
-        $e = Utils::xpQuery($parent, './saml_metadata:'.$name);
123
+        $e = Utils::xpQuery($parent, './saml_metadata:' . $name);
124 124
 
125 125
         $ret = [];
126 126
         foreach ($e as $i) {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
             return null;
147 147
         }
148 148
         if (count($e) > 1) {
149
-            throw new \Exception('More than one '.$name.' in '.$parent->tagName);
149
+            throw new \Exception('More than one ' . $name . ' in ' . $parent->tagName);
150 150
         }
151 151
 
152 152
         return $e[0];
Please login to merge, or discard this patch.
src/SAML2/XML/md/RoleDescriptor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@
 block discarded – undo
108 108
         }
109 109
 
110 110
         if (!$xml->hasAttribute('protocolSupportEnumeration')) {
111
-            throw new \Exception('Missing protocolSupportEnumeration attribute on '.$xml->localName);
111
+            throw new \Exception('Missing protocolSupportEnumeration attribute on ' . $xml->localName);
112 112
         }
113 113
         $this->protocolSupportEnumeration = preg_split('/[\s]+/', $xml->getAttribute('protocolSupportEnumeration'));
114 114
 
Please login to merge, or discard this patch.
src/SAML2/Compat/Ssp/Logger.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     public function emergency($message, array $context = []) : void
25 25
     {
26 26
         /** @psalm-suppress UndefinedClass */
27
-        SspLogger::emergency($message.($context ? " ".var_export($context, true) : ""));
27
+        SspLogger::emergency($message . ($context ? " " . var_export($context, true) : ""));
28 28
     }
29 29
 
30 30
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     public function alert($message, array $context = []) : void
44 44
     {
45 45
         /** @psalm-suppress UndefinedClass */
46
-        SspLogger::alert($message.($context ? " ".var_export($context, true) : ""));
46
+        SspLogger::alert($message . ($context ? " " . var_export($context, true) : ""));
47 47
     }
48 48
 
49 49
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     public function critical($message, array $context = []) : void
62 62
     {
63 63
         /** @psalm-suppress UndefinedClass */
64
-        SspLogger::critical($message.($context ? " ".var_export($context, true) : ""));
64
+        SspLogger::critical($message . ($context ? " " . var_export($context, true) : ""));
65 65
     }
66 66
 
67 67
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     public function error($message, array $context = []) : void
79 79
     {
80 80
         /** @psalm-suppress UndefinedClass */
81
-        SspLogger::error($message.($context ? " ".var_export($context, true) : ""));
81
+        SspLogger::error($message . ($context ? " " . var_export($context, true) : ""));
82 82
     }
83 83
 
84 84
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     public function warning($message, array $context = []) : void
98 98
     {
99 99
         /** @psalm-suppress UndefinedClass */
100
-        SspLogger::warning($message.($context ? " ".var_export($context, true) : ""));
100
+        SspLogger::warning($message . ($context ? " " . var_export($context, true) : ""));
101 101
     }
102 102
 
103 103
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     public function notice($message, array $context = []) : void
114 114
     {
115 115
         /** @psalm-suppress UndefinedClass */
116
-        SspLogger::notice($message.($context ? " ".var_export($context, true) : ""));
116
+        SspLogger::notice($message . ($context ? " " . var_export($context, true) : ""));
117 117
     }
118 118
 
119 119
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     public function info($message, array $context = []) : void
132 132
     {
133 133
         /** @psalm-suppress UndefinedClass */
134
-        SspLogger::info($message.($context ? " ".var_export($context, true) : ""));
134
+        SspLogger::info($message . ($context ? " " . var_export($context, true) : ""));
135 135
     }
136 136
 
137 137
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     public function debug($message, array $context = []) : void
148 148
     {
149 149
         /** @psalm-suppress UndefinedClass */
150
-        SspLogger::debug($message.($context ? " ".var_export($context, true) : ""));
150
+        SspLogger::debug($message . ($context ? " " . var_export($context, true) : ""));
151 151
     }
152 152
 
153 153
 
Please login to merge, or discard this patch.
src/SAML2/SOAPClient.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
             $privateKey = Crypto::loadPrivateKey($srcMetadata);
67 67
             $publicKey = Crypto::loadPublicKey($srcMetadata);
68 68
             if ($privateKey !== null && $publicKey !== null && isset($publicKey['PEM'])) {
69
-                $keyCertData = $privateKey['PEM'].$publicKey['PEM'];
70
-                $file = $container->getTempDir().'/'.sha1($keyCertData).'.pem';
69
+                $keyCertData = $privateKey['PEM'] . $publicKey['PEM'];
70
+                $file = $container->getTempDir() . '/' . sha1($keyCertData) . '.pem';
71 71
                 if (!file_exists($file)) {
72 72
                     $container->writeFile($file, $keyCertData);
73 73
                 }
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
                 if ($key['type'] !== 'X509Certificate') {
87 87
                     continue;
88 88
                 }
89
-                $certData .= "-----BEGIN CERTIFICATE-----\n".
90
-                    chunk_split($key['X509Certificate'], 64).
89
+                $certData .= "-----BEGIN CERTIFICATE-----\n" .
90
+                    chunk_split($key['X509Certificate'], 64) .
91 91
                     "-----END CERTIFICATE-----\n";
92 92
             }
93
-            $peerCertFile = $container->getTempDir().'/'.sha1($certData).'.pem';
93
+            $peerCertFile = $container->getTempDir() . '/' . sha1($certData) . '.pem';
94 94
             if (!file_exists($peerCertFile)) {
95 95
                 $container->writeFile($peerCertFile, $certData);
96 96
             }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
         // Add soap-envelopes
126 126
         $request = $msg->toSignedXML();
127
-        $request = self::START_SOAP_ENVELOPE.$request->ownerDocument->saveXML($request).self::END_SOAP_ENVELOPE;
127
+        $request = self::START_SOAP_ENVELOPE . $request->ownerDocument->saveXML($request) . self::END_SOAP_ENVELOPE;
128 128
 
129 129
         $container->debugMessage($request, 'out');
130 130
 
Please login to merge, or discard this patch.