Completed
Push — master ( 2cd087...04d939 )
by Thijs
08:00
created
src/SAML2/EncryptedAssertion.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                 break;
76 76
 
77 77
             default:
78
-                throw new \Exception('Unknown key type for encryption: ' . $key->type);
78
+                throw new \Exception('Unknown key type for encryption: '.$key->type);
79 79
         }
80 80
 
81 81
         $this->encryptedData = $enc->encryptNode($symmetricKey);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             $document = $parentElement->ownerDocument;
113 113
         }
114 114
 
115
-        $root = $document->createElementNS(Constants::NS_SAML, 'saml:' . 'EncryptedAssertion');
115
+        $root = $document->createElementNS(Constants::NS_SAML, 'saml:'.'EncryptedAssertion');
116 116
         $parentElement->appendChild($root);
117 117
 
118 118
         $root->appendChild($document->importNode($this->encryptedData, true));
Please login to merge, or discard this patch.
src/SAML2/HTTPArtifact.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         }
36 36
 
37 37
         $generatedId = pack('H*', ((string) SimpleSAML_Utilities::stringToHex(SimpleSAML_Utilities::generateRandomBytes(20))));
38
-        $artifact = base64_encode("\x00\x04\x00\x00" . sha1($message->getIssuer(), true) . $generatedId) ;
38
+        $artifact = base64_encode("\x00\x04\x00\x00".sha1($message->getIssuer(), true).$generatedId);
39 39
         $artifactData = $message->toUnsignedXML();
40 40
         $artifactDataString = $artifactData->ownerDocument->saveXML($artifactData);
41 41
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     {
78 78
         if (array_key_exists('SAMLart', $_REQUEST)) {
79 79
             $artifact = base64_decode($_REQUEST['SAMLart']);
80
-            $endpointIndex =  bin2hex(substr($artifact, 2, 2));
80
+            $endpointIndex = bin2hex(substr($artifact, 2, 2));
81 81
             $sourceId = bin2hex(substr($artifact, 4, 20));
82 82
         } else {
83 83
             throw new \Exception('Missing SAMLArt parameter.');
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
         $idpMetadata = $metadataHandler->getMetaDataConfigForSha1($sourceId, 'saml20-idp-remote');
89 89
 
90 90
         if ($idpMetadata === null) {
91
-            throw new \Exception('No metadata found for remote provider with SHA1 ID: ' . var_export($sourceId, true));
91
+            throw new \Exception('No metadata found for remote provider with SHA1 ID: '.var_export($sourceId, true));
92 92
         }
93 93
 
94 94
         $endpoint = null;
95 95
         foreach ($idpMetadata->getEndpoints('ArtifactResolutionService') as $ep) {
96
-            if ($ep['index'] ===  hexdec($endpointIndex)) {
96
+            if ($ep['index'] === hexdec($endpointIndex)) {
97 97
                 $endpoint = $ep;
98 98
                 break;
99 99
             }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             throw new \Exception('No ArtifactResolutionService with the correct index.');
104 104
         }
105 105
 
106
-        Utils::getContainer()->getLogger()->debug("ArtifactResolutionService endpoint being used is := " . $endpoint['Location']);
106
+        Utils::getContainer()->getLogger()->debug("ArtifactResolutionService endpoint being used is := ".$endpoint['Location']);
107 107
 
108 108
         //Construct the ArtifactResolve Request
109 109
         $ar = new ArtifactResolve();
Please login to merge, or discard this patch.
src/SAML2/LogoutRequest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -264,7 +264,7 @@
 block discarded – undo
264 264
         if ($this->encryptedNameId === null) {
265 265
             Utils::addNameId($root, $this->nameId);
266 266
         } else {
267
-            $eid = $root->ownerDocument->createElementNS(Constants::NS_SAML, 'saml:' . 'EncryptedID');
267
+            $eid = $root->ownerDocument->createElementNS(Constants::NS_SAML, 'saml:'.'EncryptedID');
268 268
             $root->appendChild($eid);
269 269
             $eid->appendChild($root->ownerDocument->importNode($this->encryptedNameId, true));
270 270
         }
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
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
         if ($xml->getAttribute('Version') !== '2.0') {
151 151
             /* Currently a very strict check. */
152
-            throw new \Exception('Unsupported version: ' . $xml->getAttribute('Version'));
152
+            throw new \Exception('Unsupported version: '.$xml->getAttribute('Version'));
153 153
         }
154 154
 
155 155
         $this->issueInstant = Utils::xsDateTimeToTimestamp($xml->getAttribute('IssueInstant'));
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
     {
402 402
         $this->document = DOMDocumentFactory::create();
403 403
 
404
-        $root = $this->document->createElementNS(Constants::NS_SAMLP, 'samlp:' . $this->tagName);
404
+        $root = $this->document->createElementNS(Constants::NS_SAMLP, 'samlp:'.$this->tagName);
405 405
         $this->document->appendChild($root);
406 406
 
407 407
         /* Ugly hack to add another namespace declaration to the root element. */
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
     public static function fromXML(\DOMElement $xml)
528 528
     {
529 529
         if ($xml->namespaceURI !== Constants::NS_SAMLP) {
530
-            throw new \Exception('Unknown namespace of SAML message: ' . var_export($xml->namespaceURI, true));
530
+            throw new \Exception('Unknown namespace of SAML message: '.var_export($xml->namespaceURI, true));
531 531
         }
532 532
 
533 533
         switch ($xml->localName) {
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
             case 'ArtifactResolve':
547 547
                 return new ArtifactResolve($xml);
548 548
             default:
549
-                throw new \Exception('Unknown SAML message: ' . var_export($xml->localName, true));
549
+                throw new \Exception('Unknown SAML message: '.var_export($xml->localName, true));
550 550
         }
551 551
     }
552 552
 
Please login to merge, or discard this patch.
src/SAML2/SOAPClient.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
             $privateKey = SimpleSAML_Utilities::loadPrivateKey($srcMetadata);
52 52
             $publicKey = SimpleSAML_Utilities::loadPublicKey($srcMetadata);
53 53
             if ($privateKey !== null && $publicKey !== null && isset($publicKey['PEM'])) {
54
-                $keyCertData = $privateKey['PEM'] . $publicKey['PEM'];
55
-                $file = SimpleSAML_Utilities::getTempDir() . '/' . sha1($keyCertData) . '.pem';
54
+                $keyCertData = $privateKey['PEM'].$publicKey['PEM'];
55
+                $file = SimpleSAML_Utilities::getTempDir().'/'.sha1($keyCertData).'.pem';
56 56
                 if (!file_exists($file)) {
57 57
                     SimpleSAML_Utilities::writeFile($file, $keyCertData);
58 58
                 }
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
                 if ($key['type'] !== 'X509Certificate') {
72 72
                     continue;
73 73
                 }
74
-                $certData .= "-----BEGIN CERTIFICATE-----\n" .
75
-                    chunk_split($key['X509Certificate'], 64) .
74
+                $certData .= "-----BEGIN CERTIFICATE-----\n".
75
+                    chunk_split($key['X509Certificate'], 64).
76 76
                     "-----END CERTIFICATE-----\n";
77 77
             }
78
-            $peerCertFile = SimpleSAML_Utilities::getTempDir() . '/' . sha1($certData) . '.pem';
78
+            $peerCertFile = SimpleSAML_Utilities::getTempDir().'/'.sha1($certData).'.pem';
79 79
             if (!file_exists($peerCertFile)) {
80 80
                 SimpleSAML_Utilities::writeFile($peerCertFile, $certData);
81 81
             }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
         // Add soap-envelopes
102 102
         $request = $msg->toSignedXML();
103
-        $request = self::START_SOAP_ENVELOPE . $request->ownerDocument->saveXML($request) . self::END_SOAP_ENVELOPE;
103
+        $request = self::START_SOAP_ENVELOPE.$request->ownerDocument->saveXML($request).self::END_SOAP_ENVELOPE;
104 104
 
105 105
         Utils::getContainer()->debugMessage($request, 'out');
106 106
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         // There is a fault element but we haven't found out what the fault string is
226 226
         $soapFaultString = "Unknown fault string found";
227 227
         // find out the fault string
228
-        $faultStringElement =   Utils::xpQuery($soapFaultElement, './soap-env:faultstring') ;
228
+        $faultStringElement = Utils::xpQuery($soapFaultElement, './soap-env:faultstring');
229 229
         if (!empty($faultStringElement)) {
230 230
             return $faultStringElement[0]->textContent;
231 231
         }
Please login to merge, or discard this patch.
src/SAML2/Signature/PublicKeyValidator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
         CertificateProvider $configuration
54 54
     ) {
55 55
         $logger = $this->logger;
56
-        $pemCandidates = $this->configuredKeys->filter(function (Key $key) use ($logger) {
56
+        $pemCandidates = $this->configuredKeys->filter(function(Key $key) use ($logger) {
57 57
             if (!$key instanceof X509) {
58 58
                 $logger->debug(sprintf('Skipping unknown key type: "%s"', $key['type']));
59 59
                 return false;
Please login to merge, or discard this patch.
src/SAML2/Utilities/ArrayCollection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
     {
60 60
         if ($this->count() !== 1) {
61 61
             throw new RuntimeException(sprintf(
62
-                __CLASS__ . '::' . __METHOD__ . ' requires that the collection has exactly one element, '
62
+                __CLASS__.'::'.__METHOD__.' requires that the collection has exactly one element, '
63 63
                 . '"%d" elements found',
64 64
                 $this->count()
65 65
             ));
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
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
         }
166 166
 
167 167
         /* Check the signature. */
168
-        if (! $objXMLSecDSig->verify($key)) {
168
+        if (!$objXMLSecDSig->verify($key)) {
169 169
             throw new \Exception("Unable to validate Signature");
170 170
         }
171 171
     }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         }
247 247
 
248 248
         foreach ($namespaces as $prefix => $uri) {
249
-            $newElement->setAttributeNS($uri, $prefix . ':__ns_workaround__', 'tmp');
249
+            $newElement->setAttributeNS($uri, $prefix.':__ns_workaround__', 'tmp');
250 250
             $newElement->removeAttributeNS($uri, '__ns_workaround__');
251 251
         }
252 252
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             case 'true':
280 280
                 return true;
281 281
             default:
282
-                throw new \Exception('Invalid value of boolean attribute ' . var_export($attributeName, true) . ': ' . var_export($value, true));
282
+                throw new \Exception('Invalid value of boolean attribute '.var_export($attributeName, true).': '.var_export($value, true));
283 283
         }
284 284
     }
285 285
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
             $symKeyInfoAlgo = $symmetricKeyInfo->getAlgorith();
412 412
 
413 413
             if (in_array($symKeyInfoAlgo, $blacklist, true)) {
414
-                throw new \Exception('Algorithm disabled: ' . var_export($symKeyInfoAlgo, true));
414
+                throw new \Exception('Algorithm disabled: '.var_export($symKeyInfoAlgo, true));
415 415
             }
416 416
 
417 417
             if ($symKeyInfoAlgo === XMLSecurityKey::RSA_OAEP_MGF1P && $inputKeyAlgo === XMLSecurityKey::RSA_1_5) {
@@ -427,9 +427,9 @@  discard block
 block discarded – undo
427 427
             /* Make sure that the input key format is the same as the one used to encrypt the key. */
428 428
             if ($inputKeyAlgo !== $symKeyInfoAlgo) {
429 429
                 throw new \Exception(
430
-                    'Algorithm mismatch between input key and key used to encrypt ' .
431
-                    ' the symmetric key for the message. Key was: ' .
432
-                    var_export($inputKeyAlgo, true) . '; message was: ' .
430
+                    'Algorithm mismatch between input key and key used to encrypt '.
431
+                    ' the symmetric key for the message. Key was: '.
432
+                    var_export($inputKeyAlgo, true).'; message was: '.
433 433
                     var_export($symKeyInfoAlgo, true)
434 434
                 );
435 435
             }
@@ -443,20 +443,20 @@  discard block
 block discarded – undo
443 443
                 /* To protect against "key oracle" attacks, we need to be able to create a
444 444
                  * symmetric key, and for that we need to know the key size.
445 445
                  */
446
-                throw new \Exception('Unknown key size for encryption algorithm: ' . var_export($symmetricKey->type, true));
446
+                throw new \Exception('Unknown key size for encryption algorithm: '.var_export($symmetricKey->type, true));
447 447
             }
448 448
 
449 449
             try {
450 450
                 $key = $encKey->decryptKey($symmetricKeyInfo);
451 451
                 if (strlen($key) != $keySize) {
452 452
                     throw new \Exception(
453
-                        'Unexpected key size (' . strlen($key) * 8 . 'bits) for encryption algorithm: ' .
453
+                        'Unexpected key size ('.strlen($key)*8.'bits) for encryption algorithm: '.
454 454
                         var_export($symmetricKey->type, true)
455 455
                     );
456 456
                 }
457 457
             } catch (\Exception $e) {
458 458
                 /* We failed to decrypt this key. Log it, and substitute a "random" key. */
459
-                Utils::getContainer()->getLogger()->error('Failed to decrypt symmetric key: ' . $e->getMessage());
459
+                Utils::getContainer()->getLogger()->error('Failed to decrypt symmetric key: '.$e->getMessage());
460 460
                 /* Create a replacement key, so that it looks like we fail in the same way as if the key was correctly padded. */
461 461
 
462 462
                 /* We base the symmetric key on the encrypted key and private key, so that we always behave the
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
                 $encryptedKey = $encKey->getCipherValue();
466 466
                 $pkey = openssl_pkey_get_details($symmetricKeyInfo->key);
467 467
                 $pkey = sha1(serialize($pkey), true);
468
-                $key = sha1($encryptedKey . $pkey, true);
468
+                $key = sha1($encryptedKey.$pkey, true);
469 469
 
470 470
                 /* Make sure that the key has the correct length. */
471 471
                 if (strlen($key) > $keySize) {
@@ -480,8 +480,8 @@  discard block
 block discarded – undo
480 480
             /* Make sure that the input key has the correct format. */
481 481
             if ($inputKeyAlgo !== $symKeyAlgo) {
482 482
                 throw new \Exception(
483
-                    'Algorithm mismatch between input key and key in message. ' .
484
-                    'Key was: ' . var_export($inputKeyAlgo, true) . '; message was: ' .
483
+                    'Algorithm mismatch between input key and key in message. '.
484
+                    'Key was: '.var_export($inputKeyAlgo, true).'; message was: '.
485 485
                     var_export($symKeyAlgo, true)
486 486
                 );
487 487
             }
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 
491 491
         $algorithm = $symmetricKey->getAlgorith();
492 492
         if (in_array($algorithm, $blacklist, true)) {
493
-            throw new \Exception('Algorithm disabled: ' . var_export($algorithm, true));
493
+            throw new \Exception('Algorithm disabled: '.var_export($algorithm, true));
494 494
         }
495 495
 
496 496
         /** @var string $decrypted */
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
          * namespaces needed to parse the XML.
503 503
          */
504 504
         $xml = '<root xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" '.
505
-                     'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' .
506
-            $decrypted .
505
+                     'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.
506
+            $decrypted.
507 507
             '</root>';
508 508
 
509 509
         try {
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
              * Something went wrong during decryption, but for security
543 543
              * reasons we cannot tell the user what failed.
544 544
              */
545
-            Utils::getContainer()->getLogger()->error('Decryption failed: ' . $e->getMessage());
545
+            Utils::getContainer()->getLogger()->error('Decryption failed: '.$e->getMessage());
546 546
             throw new \Exception('Failed to decrypt XML element.', 0, $e);
547 547
         }
548 548
     }
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         $regex = '/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.\\d+)?Z$/D';
705 705
         if (preg_match($regex, $time, $matches) == 0) {
706 706
             throw new \Exception(
707
-                'Invalid SAML2 timestamp passed to xsDateTimeToTimestamp: ' . $time
707
+                'Invalid SAML2 timestamp passed to xsDateTimeToTimestamp: '.$time
708 708
             );
709 709
         }
710 710
 
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
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     {
101 101
         assert('is_string($name)');
102 102
 
103
-        $e = Utils::xpQuery($parent, './saml_metadata:' . $name);
103
+        $e = Utils::xpQuery($parent, './saml_metadata:'.$name);
104 104
 
105 105
         $ret = array();
106 106
         foreach ($e as $i) {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             return null;
128 128
         }
129 129
         if (count($e) > 1) {
130
-            throw new \Exception('More than one ' . $name . ' in ' . $parent->tagName);
130
+            throw new \Exception('More than one '.$name.' in '.$parent->tagName);
131 131
         }
132 132
 
133 133
         return $e[0];
Please login to merge, or discard this patch.