@@ -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 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | $symKeyInfoAlgo = $symmetricKeyInfo->getAlgorithm(); |
| 424 | 424 | |
| 425 | 425 | if (in_array($symKeyInfoAlgo, $blacklist, true)) { |
| 426 | - throw new \Exception('Algorithm disabled: ' . var_export($symKeyInfoAlgo, true)); |
|
| 426 | + throw new \Exception('Algorithm disabled: '.var_export($symKeyInfoAlgo, true)); |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | if ($symKeyInfoAlgo === XMLSecurityKey::RSA_OAEP_MGF1P && $inputKeyAlgo === XMLSecurityKey::RSA_1_5) { |
@@ -439,9 +439,9 @@ discard block |
||
| 439 | 439 | /* Make sure that the input key format is the same as the one used to encrypt the key. */ |
| 440 | 440 | if ($inputKeyAlgo !== $symKeyInfoAlgo) { |
| 441 | 441 | throw new \Exception( |
| 442 | - 'Algorithm mismatch between input key and key used to encrypt ' . |
|
| 443 | - ' the symmetric key for the message. Key was: ' . |
|
| 444 | - var_export($inputKeyAlgo, true) . '; message was: ' . |
|
| 442 | + 'Algorithm mismatch between input key and key used to encrypt '. |
|
| 443 | + ' the symmetric key for the message. Key was: '. |
|
| 444 | + var_export($inputKeyAlgo, true).'; message was: '. |
|
| 445 | 445 | var_export($symKeyInfoAlgo, true) |
| 446 | 446 | ); |
| 447 | 447 | } |
@@ -455,20 +455,20 @@ discard block |
||
| 455 | 455 | /* To protect against "key oracle" attacks, we need to be able to create a |
| 456 | 456 | * symmetric key, and for that we need to know the key size. |
| 457 | 457 | */ |
| 458 | - throw new \Exception('Unknown key size for encryption algorithm: ' . var_export($symmetricKey->type, true)); |
|
| 458 | + throw new \Exception('Unknown key size for encryption algorithm: '.var_export($symmetricKey->type, true)); |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | try { |
| 462 | 462 | $key = $encKey->decryptKey($symmetricKeyInfo); |
| 463 | 463 | if (strlen($key) != $keySize) { |
| 464 | 464 | throw new \Exception( |
| 465 | - 'Unexpected key size (' . strlen($key) * 8 . 'bits) for encryption algorithm: ' . |
|
| 465 | + 'Unexpected key size ('.strlen($key)*8.'bits) for encryption algorithm: '. |
|
| 466 | 466 | var_export($symmetricKey->type, true) |
| 467 | 467 | ); |
| 468 | 468 | } |
| 469 | 469 | } catch (\Exception $e) { |
| 470 | 470 | /* We failed to decrypt this key. Log it, and substitute a "random" key. */ |
| 471 | - Utils::getContainer()->getLogger()->error('Failed to decrypt symmetric key: ' . $e->getMessage()); |
|
| 471 | + Utils::getContainer()->getLogger()->error('Failed to decrypt symmetric key: '.$e->getMessage()); |
|
| 472 | 472 | /* Create a replacement key, so that it looks like we fail in the same way as if the key was correctly padded. */ |
| 473 | 473 | |
| 474 | 474 | /* We base the symmetric key on the encrypted key and private key, so that we always behave the |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | $encryptedKey = $encKey->getCipherValue(); |
| 478 | 478 | $pkey = openssl_pkey_get_details($symmetricKeyInfo->key); |
| 479 | 479 | $pkey = sha1(serialize($pkey), true); |
| 480 | - $key = sha1($encryptedKey . $pkey, true); |
|
| 480 | + $key = sha1($encryptedKey.$pkey, true); |
|
| 481 | 481 | |
| 482 | 482 | /* Make sure that the key has the correct length. */ |
| 483 | 483 | if (strlen($key) > $keySize) { |
@@ -492,8 +492,8 @@ discard block |
||
| 492 | 492 | /* Make sure that the input key has the correct format. */ |
| 493 | 493 | if ($inputKeyAlgo !== $symKeyAlgo) { |
| 494 | 494 | throw new \Exception( |
| 495 | - 'Algorithm mismatch between input key and key in message. ' . |
|
| 496 | - 'Key was: ' . var_export($inputKeyAlgo, true) . '; message was: ' . |
|
| 495 | + 'Algorithm mismatch between input key and key in message. '. |
|
| 496 | + 'Key was: '.var_export($inputKeyAlgo, true).'; message was: '. |
|
| 497 | 497 | var_export($symKeyAlgo, true) |
| 498 | 498 | ); |
| 499 | 499 | } |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | |
| 503 | 503 | $algorithm = $symmetricKey->getAlgorithm(); |
| 504 | 504 | if (in_array($algorithm, $blacklist, true)) { |
| 505 | - throw new \Exception('Algorithm disabled: ' . var_export($algorithm, true)); |
|
| 505 | + throw new \Exception('Algorithm disabled: '.var_export($algorithm, true)); |
|
| 506 | 506 | } |
| 507 | 507 | |
| 508 | 508 | /** @var string $decrypted */ |
@@ -514,8 +514,8 @@ discard block |
||
| 514 | 514 | * namespaces needed to parse the XML. |
| 515 | 515 | */ |
| 516 | 516 | $xml = '<root xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" '. |
| 517 | - 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . |
|
| 518 | - $decrypted . |
|
| 517 | + 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'. |
|
| 518 | + $decrypted. |
|
| 519 | 519 | '</root>'; |
| 520 | 520 | |
| 521 | 521 | try { |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | * Something went wrong during decryption, but for security |
| 555 | 555 | * reasons we cannot tell the user what failed. |
| 556 | 556 | */ |
| 557 | - Utils::getContainer()->getLogger()->error('Decryption failed: ' . $e->getMessage()); |
|
| 557 | + Utils::getContainer()->getLogger()->error('Decryption failed: '.$e->getMessage()); |
|
| 558 | 558 | throw new \Exception('Failed to decrypt XML element.', 0, $e); |
| 559 | 559 | } |
| 560 | 560 | } |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | $regex = '/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.\\d{1,9})?Z$/D'; |
| 717 | 717 | if (preg_match($regex, $time, $matches) == 0) { |
| 718 | 718 | throw new \Exception( |
| 719 | - 'Invalid SAML2 timestamp passed to xsDateTimeToTimestamp: ' . $time |
|
| 719 | + 'Invalid SAML2 timestamp passed to xsDateTimeToTimestamp: '.$time |
|
| 720 | 720 | ); |
| 721 | 721 | } |
| 722 | 722 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | public function emergency($message, array $context = []) |
| 18 | 18 | { |
| 19 | - \SimpleSAML\Logger::emergency($message . ($context ? " " . var_export($context, true) : "")); |
|
| 19 | + \SimpleSAML\Logger::emergency($message.($context ? " ".var_export($context, true) : "")); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function alert($message, array $context = []) |
| 33 | 33 | { |
| 34 | - \SimpleSAML\Logger::alert($message . ($context ? " " . var_export($context, true) : "")); |
|
| 34 | + \SimpleSAML\Logger::alert($message.($context ? " ".var_export($context, true) : "")); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function critical($message, array $context = []) |
| 47 | 47 | { |
| 48 | - \SimpleSAML\Logger::critical($message . ($context ? " " . var_export($context, true) : "")); |
|
| 48 | + \SimpleSAML\Logger::critical($message.($context ? " ".var_export($context, true) : "")); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function error($message, array $context = []) |
| 60 | 60 | { |
| 61 | - \SimpleSAML\Logger::error($message . ($context ? " " . var_export($context, true) : "")); |
|
| 61 | + \SimpleSAML\Logger::error($message.($context ? " ".var_export($context, true) : "")); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function warning($message, array $context = []) |
| 75 | 75 | { |
| 76 | - \SimpleSAML\Logger::warning($message . ($context ? " " . var_export($context, true) : "")); |
|
| 76 | + \SimpleSAML\Logger::warning($message.($context ? " ".var_export($context, true) : "")); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function notice($message, array $context = []) |
| 87 | 87 | { |
| 88 | - \SimpleSAML\Logger::notice($message . ($context ? " " . var_export($context, true) : "")); |
|
| 88 | + \SimpleSAML\Logger::notice($message.($context ? " ".var_export($context, true) : "")); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function info($message, array $context = []) |
| 101 | 101 | { |
| 102 | - \SimpleSAML\Logger::info($message . ($context ? " " . var_export($context, true) : "")); |
|
| 102 | + \SimpleSAML\Logger::info($message.($context ? " ".var_export($context, true) : "")); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function debug($message, array $context = []) |
| 113 | 113 | { |
| 114 | - \SimpleSAML\Logger::debug($message . ($context ? " " . var_export($context, true) : "")); |
|
| 114 | + \SimpleSAML\Logger::debug($message.($context ? " ".var_export($context, true) : "")); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | public function getPrivateKey(string $name, bool $required = false) |
| 54 | 54 | { |
| 55 | 55 | $privateKeys = $this->get('privateKeys'); |
| 56 | - $key = array_filter($privateKeys, function (PrivateKey $key) use ($name) { |
|
| 56 | + $key = array_filter($privateKeys, function(PrivateKey $key) use ($name) { |
|
| 57 | 57 | return $key->getName() === $name; |
| 58 | 58 | }); |
| 59 | 59 | |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | public function getPrivateKey(string $name, bool $required = false) |
| 52 | 52 | { |
| 53 | 53 | $privateKeys = $this->get('privateKeys'); |
| 54 | - $key = array_filter($privateKeys, function (PrivateKey $key) use ($name) { |
|
| 54 | + $key = array_filter($privateKeys, function(PrivateKey $key) use ($name) { |
|
| 55 | 55 | return $key->getName() === $name; |
| 56 | 56 | }); |
| 57 | 57 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | if (array_key_exists('SAMLart', $_REQUEST)) { |
| 83 | 83 | $artifact = base64_decode($_REQUEST['SAMLart']); |
| 84 | - $endpointIndex = bin2hex(substr($artifact, 2, 2)); |
|
| 84 | + $endpointIndex = bin2hex(substr($artifact, 2, 2)); |
|
| 85 | 85 | $sourceId = bin2hex(substr($artifact, 4, 20)); |
| 86 | 86 | } else { |
| 87 | 87 | throw new \Exception('Missing SAMLart parameter.'); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | $endpoint = null; |
| 99 | 99 | foreach ($idpMetadata->getEndpoints('ArtifactResolutionService') as $ep) { |
| 100 | - if ($ep['index'] === hexdec($endpointIndex)) { |
|
| 100 | + if ($ep['index'] === hexdec($endpointIndex)) { |
|
| 101 | 101 | $endpoint = $ep; |
| 102 | 102 | break; |
| 103 | 103 | } |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | |
| 70 | 70 | // ported from |
| 71 | 71 | // https://github.com/simplesamlphp/simplesamlphp/blob/3d735912342767d391297cc5e13272a76730aca0/lib/SimpleSAML/Configuration.php#L1119 |
| 72 | - if ($configuration->hasValue($prefix . 'certificate')) { |
|
| 72 | + if ($configuration->hasValue($prefix.'certificate')) { |
|
| 73 | 73 | $extracted['certificateData'] = $configuration->getString($prefix.'certificate'); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | |
| 283 | 283 | if ($xml->getAttribute('Version') !== '2.0') { |
| 284 | 284 | /* Currently a very strict check. */ |
| 285 | - throw new \Exception('Unsupported version: ' . $xml->getAttribute('Version')); |
|
| 285 | + throw new \Exception('Unsupported version: '.$xml->getAttribute('Version')); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | $this->issueInstant = Utils::xsDateTimeToTimestamp($xml->getAttribute('IssueInstant')); |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | continue; |
| 385 | 385 | } |
| 386 | 386 | if ($node->namespaceURI !== Constants::NS_SAML) { |
| 387 | - throw new \Exception('Unknown namespace of condition: ' . var_export($node->namespaceURI, true)); |
|
| 387 | + throw new \Exception('Unknown namespace of condition: '.var_export($node->namespaceURI, true)); |
|
| 388 | 388 | } |
| 389 | 389 | switch ($node->localName) { |
| 390 | 390 | case 'AudienceRestriction': |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | /* Currently ignored. */ |
| 408 | 408 | break; |
| 409 | 409 | default: |
| 410 | - throw new \Exception('Unknown condition: ' . var_export($node->localName, true)); |
|
| 410 | + throw new \Exception('Unknown condition: '.var_export($node->localName, true)); |
|
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | } |
@@ -1305,7 +1305,7 @@ discard block |
||
| 1305 | 1305 | $document = $parentElement->ownerDocument; |
| 1306 | 1306 | } |
| 1307 | 1307 | |
| 1308 | - $root = $document->createElementNS(Constants::NS_SAML, 'saml:' . 'Assertion'); |
|
| 1308 | + $root = $document->createElementNS(Constants::NS_SAML, 'saml:'.'Assertion'); |
|
| 1309 | 1309 | $parentElement->appendChild($root); |
| 1310 | 1310 | |
| 1311 | 1311 | /* Ugly hack to add another namespace declaration to the root element. */ |
@@ -1361,7 +1361,7 @@ discard block |
||
| 1361 | 1361 | if ($this->encryptedNameId === null) { |
| 1362 | 1362 | $this->nameId->toXML($subject); |
| 1363 | 1363 | } else { |
| 1364 | - $eid = $subject->ownerDocument->createElementNS(Constants::NS_SAML, 'saml:' . 'EncryptedID'); |
|
| 1364 | + $eid = $subject->ownerDocument->createElementNS(Constants::NS_SAML, 'saml:'.'EncryptedID'); |
|
| 1365 | 1365 | $subject->appendChild($eid); |
| 1366 | 1366 | $eid->appendChild($subject->ownerDocument->importNode($this->encryptedNameId, true)); |
| 1367 | 1367 | } |
@@ -1513,7 +1513,7 @@ discard block |
||
| 1513 | 1513 | if (is_array($this->attributesValueTypes) && array_key_exists($name, $this->attributesValueTypes)) { |
| 1514 | 1514 | $valueTypes = $this->attributesValueTypes[$name]; |
| 1515 | 1515 | if (is_array($valueTypes) && count($valueTypes) != count($values)) { |
| 1516 | - throw new \Exception('Array of value types and array of values have different size for attribute '. var_export($name, true)); |
|
| 1516 | + throw new \Exception('Array of value types and array of values have different size for attribute '.var_export($name, true)); |
|
| 1517 | 1517 | } |
| 1518 | 1518 | } else { |
| 1519 | 1519 | // if no type(s), default behaviour |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if (!$xml->hasAttribute('index')) { |
| 45 | - throw new \Exception('Missing index on ' . $xml->tagName); |
|
| 45 | + throw new \Exception('Missing index on '.$xml->tagName); |
|
| 46 | 46 | } |
| 47 | 47 | $this->index = intval($xml->getAttribute('index')); |
| 48 | 48 | |