diff --git a/composer.json b/composer.json index d545129..243e148 100644 --- a/composer.json +++ b/composer.json @@ -28,4 +28,4 @@ "archive": { "exclude": ["/example", "/tests"] } -} +} \ No newline at end of file diff --git a/src/Spid/Saml/In/Response.php b/src/Spid/Saml/In/Response.php index b3738fe..1292a6f 100644 --- a/src/Spid/Saml/In/Response.php +++ b/src/Spid/Saml/In/Response.php @@ -57,8 +57,8 @@ public function validate($xml, $hasAssertion): bool } elseif ($xml->getElementsByTagName('Issuer')->item(0)->nodeValue != $_SESSION['idpEntityId']) { throw new \Exception("Invalid Issuer attribute, expected " . $_SESSION['idpEntityId'] . " but received " . $xml->getElementsByTagName('Issuer')->item(0)->nodeValue); - } elseif ($xml->getElementsByTagName('Issuer')->item(0)->getAttribute('Format') != - 'urn:oasis:names:tc:SAML:2.0:nameid-format:entity') { + } elseif (!epmty($xml->getElementsByTagName('Issuer')->item(0)->getAttribute('Format')) && + $xml->getElementsByTagName('Issuer')->item(0)->getAttribute('Format') != 'urn:oasis:names:tc:SAML:2.0:nameid-format:entity') { throw new \Exception("Invalid Issuer attribute, expected 'urn:oasis:names:tc:SAML:2.0:nameid-format:" . "entity'" . " but received " . $xml->getElementsByTagName('Issuer')->item(0)->getAttribute('Format')); }