Completed
Branch release-4-alpha (c39975)
by Tim
03:57
created
src/SAML2/Certificate/KeyLoader.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 use SAML2\Certificate\Exception\InvalidCertificateStructureException;
8 8
 use SAML2\Certificate\Exception\NoKeysFoundException;
9 9
 use SAML2\Configuration\CertificateProvider;
10
-use SAML2\Exception\InvalidArgumentException;
11 10
 use SAML2\Utilities\Certificate;
12 11
 use SAML2\Utilities\File;
13 12
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
                 $key = new Key($keyData);
96 96
             }
97 97
 
98
-            if ($usage !== null  && !$key->canBeUsedFor($usage)) {
98
+            if ($usage !== null && !$key->canBeUsedFor($usage)) {
99 99
                 continue;
100 100
             }
101 101
 
Please login to merge, or discard this patch.
src/SAML2/Configuration/ServiceProvider.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
     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
 
Please login to merge, or discard this patch.
src/SAML2/Configuration/IdentityProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/SAML2/Configuration/SimpleSAMLConverter.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,20 +57,20 @@
 block discarded – undo
57 57
 
58 58
         // ported from
59 59
         // https://github.com/simplesamlphp/simplesamlphp/blob/3d735912342767d391297cc5e13272a76730aca0/lib/SimpleSAML/Configuration.php#L1092
60
-        if ($configuration->hasValue($prefix . 'keys')) {
61
-            $extracted['keys'] = $configuration->getArray($prefix . 'keys');
60
+        if ($configuration->hasValue($prefix.'keys')) {
61
+            $extracted['keys'] = $configuration->getArray($prefix.'keys');
62 62
         }
63 63
 
64 64
         // ported from
65 65
         // https://github.com/simplesamlphp/simplesamlphp/blob/3d735912342767d391297cc5e13272a76730aca0/lib/SimpleSAML/Configuration.php#L1108
66
-        if ($configuration->hasValue($prefix . 'certData')) {
67
-            $extracted['certificateData'] = $configuration->getString($prefix . 'certData');
66
+        if ($configuration->hasValue($prefix.'certData')) {
67
+            $extracted['certificateData'] = $configuration->getString($prefix.'certData');
68 68
         }
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')) {
73
-            $extracted['certificateData'] = $configuration->getString($prefix . 'certificate');
72
+        if ($configuration->hasValue($prefix.'certificate')) {
73
+            $extracted['certificateData'] = $configuration->getString($prefix.'certificate');
74 74
         }
75 75
 
76 76
         $extracted['assertionEncryptionEnabled'] = $configuration->getBoolean('assertion.encryption', false);
Please login to merge, or discard this patch.
src/SAML2/XML/md/EndpointType.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
         }
55 55
 
56 56
         if (!$xml->hasAttribute('Binding')) {
57
-            throw new \Exception('Missing Binding on ' . $xml->tagName);
57
+            throw new \Exception('Missing Binding on '.$xml->tagName);
58 58
         }
59 59
         $this->Binding = $xml->getAttribute('Binding');
60 60
 
61 61
         if (!$xml->hasAttribute('Location')) {
62
-            throw new \Exception('Missing Location on ' . $xml->tagName);
62
+            throw new \Exception('Missing Location on '.$xml->tagName);
63 63
         }
64 64
         $this->Location = $xml->getAttribute('Location');
65 65
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             if ($a->namespaceURI === null) {
72 72
                 continue; /* Not namespace-qualified -- skip. */
73 73
             }
74
-            $fullName = '{' . $a->namespaceURI . '}' . $a->localName;
74
+            $fullName = '{'.$a->namespaceURI.'}'.$a->localName;
75 75
             $this->attributes[$fullName] = [
76 76
                 'qualifiedName' => $a->nodeName,
77 77
                 'namespaceURI' => $a->namespaceURI,
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function hasAttributeNS(string $namespaceURI, string $localName)
91 91
     {
92
-        $fullName = '{' . $namespaceURI . '}' . $localName;
92
+        $fullName = '{'.$namespaceURI.'}'.$localName;
93 93
 
94 94
         return isset($this->attributes[$fullName]);
95 95
     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function getAttributeNS(string $namespaceURI, string $localName)
105 105
     {
106
-        $fullName = '{' . $namespaceURI . '}' . $localName;
106
+        $fullName = '{'.$namespaceURI.'}'.$localName;
107 107
         if (!isset($this->attributes[$fullName])) {
108 108
             return '';
109 109
         }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         }
128 128
         $localName = $name[1];
129 129
 
130
-        $fullName = '{' . $namespaceURI . '}' . $localName;
130
+        $fullName = '{'.$namespaceURI.'}'.$localName;
131 131
         $this->attributes[$fullName] = [
132 132
             'qualifiedName' => $qualifiedName,
133 133
             'namespaceURI' => $namespaceURI,
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      */
144 144
     public function removeAttributeNS(string $namespaceURI, string $localName)
145 145
     {
146
-        $fullName = '{' . $namespaceURI . '}' . $localName;
146
+        $fullName = '{'.$namespaceURI.'}'.$localName;
147 147
         unset($this->attributes[$fullName]);
148 148
     }
149 149
 
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
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      */
116 116
     private static function getStringElements(\DOMElement $parent, string $name)
117 117
     {
118
-        $e = Utils::xpQuery($parent, './saml_metadata:' . $name);
118
+        $e = Utils::xpQuery($parent, './saml_metadata:'.$name);
119 119
 
120 120
         $ret = [];
121 121
         foreach ($e as $i) {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             return null;
141 141
         }
142 142
         if (count($e) > 1) {
143
-            throw new \Exception('More than one ' . $name . ' in ' . $parent->tagName);
143
+            throw new \Exception('More than one '.$name.' in '.$parent->tagName);
144 144
         }
145 145
 
146 146
         return $e[0];
Please login to merge, or discard this patch.
src/SAML2/SignedElementHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -175,8 +175,8 @@
 block discarded – undo
175 175
         $ret = [];
176 176
         foreach ($this->certificates as $cert) {
177 177
             /* Construct a PEM formatted certificate */
178
-            $pemCert = "-----BEGIN CERTIFICATE-----\n" .
179
-                chunk_split($cert, 64) .
178
+            $pemCert = "-----BEGIN CERTIFICATE-----\n".
179
+                chunk_split($cert, 64).
180 180
                 "-----END CERTIFICATE-----\n";
181 181
 
182 182
             /* Extract the public key from the certificate for validation. */
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
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         }
41 41
 
42 42
         $generatedId = pack('H*', bin2hex(openssl_random_pseudo_bytes(20)));
43
-        $artifact = base64_encode("\x00\x04\x00\x00" . sha1($message->getIssuer(), true) . $generatedId) ;
43
+        $artifact = base64_encode("\x00\x04\x00\x00".sha1($message->getIssuer(), true).$generatedId);
44 44
         $artifactData = $message->toUnsignedXML();
45 45
         $artifactDataString = $artifactData->ownerDocument->saveXML($artifactData);
46 46
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     {
83 83
         if (array_key_exists('SAMLart', $_REQUEST)) {
84 84
             $artifact = base64_decode($_REQUEST['SAMLart']);
85
-            $endpointIndex =  bin2hex(substr($artifact, 2, 2));
85
+            $endpointIndex = bin2hex(substr($artifact, 2, 2));
86 86
             $sourceId = bin2hex(substr($artifact, 4, 20));
87 87
         } else {
88 88
             throw new \Exception('Missing SAMLart parameter.');
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
         $idpMetadata = $metadataHandler->getMetaDataConfigForSha1($sourceId, 'saml20-idp-remote');
94 94
 
95 95
         if ($idpMetadata === null) {
96
-            throw new \Exception('No metadata found for remote provider with SHA1 ID: ' . var_export($sourceId, true));
96
+            throw new \Exception('No metadata found for remote provider with SHA1 ID: '.var_export($sourceId, true));
97 97
         }
98 98
 
99 99
         $endpoint = null;
100 100
         foreach ($idpMetadata->getEndpoints('ArtifactResolutionService') as $ep) {
101
-            if ($ep['index'] ===  hexdec($endpointIndex)) {
101
+            if ($ep['index'] === hexdec($endpointIndex)) {
102 102
                 $endpoint = $ep;
103 103
                 break;
104 104
             }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             throw new \Exception('No ArtifactResolutionService with the correct index.');
109 109
         }
110 110
 
111
-        Utils::getContainer()->getLogger()->debug("ArtifactResolutionService endpoint being used is := " . $endpoint['Location']);
111
+        Utils::getContainer()->getLogger()->debug("ArtifactResolutionService endpoint being used is := ".$endpoint['Location']);
112 112
 
113 113
         //Construct the ArtifactResolve Request
114 114
         $ar = new ArtifactResolve();
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
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
             $privateKey = \SimpleSAML\Utils\Crypto::loadPrivateKey($srcMetadata);
56 56
             $publicKey = \SimpleSAML\Utils\Crypto::loadPublicKey($srcMetadata);
57 57
             if ($privateKey !== null && $publicKey !== null && isset($publicKey['PEM'])) {
58
-                $keyCertData = $privateKey['PEM'] . $publicKey['PEM'];
59
-                $file = \SimpleSAML\Utils\System::getTempDir() . '/' . sha1($keyCertData) . '.pem';
58
+                $keyCertData = $privateKey['PEM'].$publicKey['PEM'];
59
+                $file = \SimpleSAML\Utils\System::getTempDir().'/'.sha1($keyCertData).'.pem';
60 60
                 if (!file_exists($file)) {
61 61
                     \SimpleSAML\Utils\System::writeFile($file, $keyCertData);
62 62
                 }
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
                 if ($key['type'] !== 'X509Certificate') {
76 76
                     continue;
77 77
                 }
78
-                $certData .= "-----BEGIN CERTIFICATE-----\n" .
79
-                    chunk_split($key['X509Certificate'], 64) .
78
+                $certData .= "-----BEGIN CERTIFICATE-----\n".
79
+                    chunk_split($key['X509Certificate'], 64).
80 80
                     "-----END CERTIFICATE-----\n";
81 81
             }
82
-            $peerCertFile = \SimpleSAML\Utils\System::getTempDir() . '/' . sha1($certData) . '.pem';
82
+            $peerCertFile = \SimpleSAML\Utils\System::getTempDir().'/'.sha1($certData).'.pem';
83 83
             if (!file_exists($peerCertFile)) {
84 84
                 \SimpleSAML\Utils\System::writeFile($peerCertFile, $certData);
85 85
             }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
         // Add soap-envelopes
118 118
         $request = $msg->toSignedXML();
119
-        $request = self::START_SOAP_ENVELOPE . $request->ownerDocument->saveXML($request) . self::END_SOAP_ENVELOPE;
119
+        $request = self::START_SOAP_ENVELOPE.$request->ownerDocument->saveXML($request).self::END_SOAP_ENVELOPE;
120 120
 
121 121
         Utils::getContainer()->debugMessage($request, 'out');
122 122
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         // There is a fault element but we haven't found out what the fault string is
240 240
         $soapFaultString = "Unknown fault string found";
241 241
         // find out the fault string
242
-        $faultStringElement =   Utils::xpQuery($soapFaultElement, './soap-env:faultstring') ;
242
+        $faultStringElement = Utils::xpQuery($soapFaultElement, './soap-env:faultstring');
243 243
         if (!empty($faultStringElement)) {
244 244
             return $faultStringElement[0]->textContent;
245 245
         }
Please login to merge, or discard this patch.