@@ -53,7 +53,7 @@ |
||
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; |
@@ -59,7 +59,7 @@ |
||
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 | )); |
@@ -165,7 +165,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -100,7 +100,7 @@ discard block |
||
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 |
||
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]; |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | if (!$xml->hasAttribute('Binding')) { |
55 | - throw new \Exception('Missing Binding on ' . $xml->tagName); |
|
55 | + throw new \Exception('Missing Binding on '.$xml->tagName); |
|
56 | 56 | } |
57 | 57 | $this->Binding = $xml->getAttribute('Binding'); |
58 | 58 | |
59 | 59 | if (!$xml->hasAttribute('Location')) { |
60 | - throw new \Exception('Missing Location on ' . $xml->tagName); |
|
60 | + throw new \Exception('Missing Location on '.$xml->tagName); |
|
61 | 61 | } |
62 | 62 | $this->Location = $xml->getAttribute('Location'); |
63 | 63 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | if ($a->namespaceURI === null) { |
70 | 70 | continue; /* Not namespace-qualified -- skip. */ |
71 | 71 | } |
72 | - $fullName = '{' . $a->namespaceURI . '}' . $a->localName; |
|
72 | + $fullName = '{'.$a->namespaceURI.'}'.$a->localName; |
|
73 | 73 | $this->attributes[$fullName] = array( |
74 | 74 | 'qualifiedName' => $a->nodeName, |
75 | 75 | 'namespaceURI' => $a->namespaceURI, |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | assert('is_string($namespaceURI)'); |
91 | 91 | assert('is_string($localName)'); |
92 | 92 | |
93 | - $fullName = '{' . $namespaceURI . '}' . $localName; |
|
93 | + $fullName = '{'.$namespaceURI.'}'.$localName; |
|
94 | 94 | |
95 | 95 | return isset($this->attributes[$fullName]); |
96 | 96 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | assert('is_string($namespaceURI)'); |
108 | 108 | assert('is_string($localName)'); |
109 | 109 | |
110 | - $fullName = '{' . $namespaceURI . '}' . $localName; |
|
110 | + $fullName = '{'.$namespaceURI.'}'.$localName; |
|
111 | 111 | if (!isset($this->attributes[$fullName])) { |
112 | 112 | return ''; |
113 | 113 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | $localName = $name[1]; |
136 | 136 | |
137 | - $fullName = '{' . $namespaceURI . '}' . $localName; |
|
137 | + $fullName = '{'.$namespaceURI.'}'.$localName; |
|
138 | 138 | $this->attributes[$fullName] = array( |
139 | 139 | 'qualifiedName' => $qualifiedName, |
140 | 140 | 'namespaceURI' => $namespaceURI, |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | assert('is_string($namespaceURI)'); |
154 | 154 | assert('is_string($localName)'); |
155 | 155 | |
156 | - $fullName = '{' . $namespaceURI . '}' . $localName; |
|
156 | + $fullName = '{'.$namespaceURI.'}'.$localName; |
|
157 | 157 | unset($this->attributes[$fullName]); |
158 | 158 | } |
159 | 159 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | if (!$xml->hasAttribute('index')) { |
43 | - throw new \Exception('Missing index on ' . $xml->tagName); |
|
43 | + throw new \Exception('Missing index on '.$xml->tagName); |
|
44 | 44 | } |
45 | 45 | $this->index = (int) $xml->getAttribute('index'); |
46 | 46 |
@@ -118,7 +118,7 @@ |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | if (!$xml->hasAttribute('protocolSupportEnumeration')) { |
121 | - throw new \Exception('Missing protocolSupportEnumeration attribute on ' . $xml->localName); |
|
121 | + throw new \Exception('Missing protocolSupportEnumeration attribute on '.$xml->localName); |
|
122 | 122 | } |
123 | 123 | $this->protocolSupportEnumeration = preg_split('/[\s]+/', $xml->getAttribute('protocolSupportEnumeration')); |
124 | 124 |
@@ -59,8 +59,8 @@ |
||
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - $this->IPHint = Utils::extractStrings($xml, self::NS, 'IPHint'); |
|
63 | - $this->DomainHint = Utils::extractStrings($xml, self::NS, 'DomainHint'); |
|
62 | + $this->IPHint = Utils::extractStrings($xml, self::NS, 'IPHint'); |
|
63 | + $this->DomainHint = Utils::extractStrings($xml, self::NS, 'DomainHint'); |
|
64 | 64 | $this->GeolocationHint = Utils::extractStrings($xml, self::NS, 'GeolocationHint'); |
65 | 65 | |
66 | 66 | foreach (Utils::xpQuery($xml, "./*[namespace-uri()!='".self::NS."']") as $node) { |
@@ -49,21 +49,21 @@ discard block |
||
49 | 49 | $msg .= urlencode($msgStr); |
50 | 50 | |
51 | 51 | if ($relayState !== null) { |
52 | - $msg .= '&RelayState=' . urlencode($relayState); |
|
52 | + $msg .= '&RelayState='.urlencode($relayState); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | if ($key !== null) { |
56 | 56 | /* Add the signature. */ |
57 | - $msg .= '&SigAlg=' . urlencode($key->type); |
|
57 | + $msg .= '&SigAlg='.urlencode($key->type); |
|
58 | 58 | |
59 | 59 | $signature = $key->signData($msg); |
60 | - $msg .= '&Signature=' . urlencode(base64_encode($signature)); |
|
60 | + $msg .= '&Signature='.urlencode(base64_encode($signature)); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | if (strpos($destination, '?') === false) { |
64 | - $destination .= '?' . $msg; |
|
64 | + $destination .= '?'.$msg; |
|
65 | 65 | } else { |
66 | - $destination .= '&' . $msg; |
|
66 | + $destination .= '&'.$msg; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | return $destination; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function send(Message $message) |
80 | 80 | { |
81 | 81 | $destination = $this->getRedirectURL($message); |
82 | - Utils::getContainer()->getLogger()->debug('Redirect to ' . strlen($destination) . ' byte URL: ' . $destination); |
|
82 | + Utils::getContainer()->getLogger()->debug('Redirect to '.strlen($destination).' byte URL: '.$destination); |
|
83 | 83 | Utils::getContainer()->redirect($destination); |
84 | 84 | } |
85 | 85 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | if (isset($data['SAMLEncoding']) && $data['SAMLEncoding'] !== self::DEFLATE) { |
109 | - throw new \Exception('Unknown SAMLEncoding: ' . var_export($data['SAMLEncoding'], true)); |
|
109 | + throw new \Exception('Unknown SAMLEncoding: '.var_export($data['SAMLEncoding'], true)); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $message = base64_decode($message); |
@@ -182,18 +182,18 @@ discard block |
||
182 | 182 | switch ($name) { |
183 | 183 | case 'SAMLRequest': |
184 | 184 | case 'SAMLResponse': |
185 | - $sigQuery = $name . '=' . $value; |
|
185 | + $sigQuery = $name.'='.$value; |
|
186 | 186 | break; |
187 | 187 | case 'RelayState': |
188 | - $relayState = '&RelayState=' . $value; |
|
188 | + $relayState = '&RelayState='.$value; |
|
189 | 189 | break; |
190 | 190 | case 'SigAlg': |
191 | - $sigAlg = '&SigAlg=' . $value; |
|
191 | + $sigAlg = '&SigAlg='.$value; |
|
192 | 192 | break; |
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
196 | - $data['SignedQuery'] = $sigQuery . $relayState . $sigAlg; |
|
196 | + $data['SignedQuery'] = $sigQuery.$relayState.$sigAlg; |
|
197 | 197 | |
198 | 198 | return $data; |
199 | 199 | } |