From 3c2db394ada86bf72bef1f81be049734851b133f Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Tue, 21 Apr 2009 06:49:14 +0000
Subject: [PATCH] Metadata/SAMLParser: Only issue a warning for unsupported
 entities.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1465 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Metadata/SAMLParser.php | 28 +++++++++++++++-----------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php
index 7ea454bc7..cec041f65 100644
--- a/lib/SimpleSAML/Metadata/SAMLParser.php
+++ b/lib/SimpleSAML/Metadata/SAMLParser.php
@@ -472,12 +472,12 @@ class SimpleSAML_Metadata_SAMLParser {
 		/* Find the assertion consumer service endpoint. */
 		$acs = $this->getDefaultEndpoint($spd['assertionConsumerServices'], array(self::SAML_1X_POST_BINDING));
 		if($acs === NULL) {
-			throw new Exception('Could not find any valid AssertionConsumerService.' .
-				' simpleSAMLphp currently supports only the browser-post binding for SAML 1.x.');
+			SimpleSAML_Logger::warning('Could not find a supported SAML 1.x AssertionConsumerService endpoint for ' .
+				var_export($ret['entityid'], TRUE) . '.');
+		} else {
+			$ret['AssertionConsumerService'] = $acs['location'];
 		}
 
-		$ret['AssertionConsumerService'] = $acs['location'];
-
 		/* Add certificate data. Only the first valid certificate will be added. */
 		foreach($spd['keys'] as $key) {
 			if($key['type'] !== 'X509Certificate') {
@@ -534,9 +534,11 @@ class SimpleSAML_Metadata_SAMLParser {
 		/* Find the SSO service endpoint. */
 		$sso = $this->getDefaultEndpoint($idp['singleSignOnServices'], array(self::SAML_1x_AUTHN_REQUEST));
 		if($sso === NULL) {
-			throw new Exception('Could not find any valid SingleSignOnService endpoint.');
+			SimpleSAML_Logger::warning('Could not find a supported SAML 1.x SingleSignOnService endpoint for ' .
+				var_export($ret['entityid'], TRUE) . '.');
+		} else {
+			$ret['SingleSignOnService'] = $sso['location'];
 		}
-		$ret['SingleSignOnService'] = $sso['location'];
 
 		/* Add certificate to metadata. Only the first valid certificate will be added. */
 		$ret['certFingerprint'] = array();
@@ -598,12 +600,12 @@ class SimpleSAML_Metadata_SAMLParser {
 		/* Find the assertion consumer service endpoint. */
 		$acs = $this->getDefaultEndpoint($spd['assertionConsumerServices'], array(self::SAML_20_POST_BINDING));
 		if($acs === NULL) {
-			throw new Exception('Could not find any valid AssertionConsumerService.' .
-				' simpleSAMLphp currently supports only the http-post binding for SAML 2.0 assertions.');
+			SimpleSAML_Logger::warning('Could not find a supported SAML 2.0 AssertionConsumerService endpoint for ' .
+				var_export($ret['entityid'], TRUE) . '.');
+		} else {
+			$ret['AssertionConsumerService'] = $acs['location'];
 		}
 
-		$ret['AssertionConsumerService'] = $acs['location'];
-
 
 		/* Find the single logout service endpoint. */
 		$slo = $this->getDefaultEndpoint($spd['singleLogoutServices'], array(self::SAML_20_REDIRECT_BINDING));
@@ -694,9 +696,11 @@ class SimpleSAML_Metadata_SAMLParser {
 		/* Find the SSO service endpoint. */
 		$sso = $this->getDefaultEndpoint($idp['singleSignOnServices'], array(self::SAML_20_REDIRECT_BINDING));
 		if($sso === NULL) {
-			throw new Exception('Could not find any valid SingleSignOnService endpoint.');
+			SimpleSAML_Logger::warning('Could not find a supported SAML 2.0 SingleSignOnService endpoint for ' .
+				var_export($ret['entityid'], TRUE) . '.');
+		} else {
+			$ret['SingleSignOnService'] = $sso['location'];
 		}
-		$ret['SingleSignOnService'] = $sso['location'];
 
 
 		/* Find the single logout service endpoint. */
-- 
GitLab