From 4a44792a835d4fe57ffcbbf035bc06e83877eb78 Mon Sep 17 00:00:00 2001 From: Jonathan Warner Date: Wed, 11 Jun 2014 15:34:37 -0400 Subject: [PATCH 1/6] Change package name for Composer installation --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9eca195b..75e295a2 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "onelogin/php-saml", + "name": "ucfcdl/php-saml", "description": "OneLogin PHP SAML Toolkit", "license": "MIT", "version": "2.0.0", From ac3975225c4e9066fd9e0696063c6174141c59f5 Mon Sep 17 00:00:00 2001 From: Jonathan Warner Date: Wed, 11 Jun 2014 15:37:10 -0400 Subject: [PATCH 2/6] Bypass for Shib not using NameID --- lib/Saml2/Response.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Saml2/Response.php b/lib/Saml2/Response.php index fc1f808c..2c460f94 100644 --- a/lib/Saml2/Response.php +++ b/lib/Saml2/Response.php @@ -355,7 +355,8 @@ public function getNameIdData() } if (!isset($nameId)) { - throw new Exception("Not NameID found in the assertion of the Response"); + //throw new Exception("Not NameID found in the assertion of the Response"); + return; } $nameIdData = array(); From b6560e21e8cf4fd62b8bc01c52302532a8f24d5b Mon Sep 17 00:00:00 2001 From: Jonathan Warner Date: Wed, 11 Jun 2014 15:38:53 -0400 Subject: [PATCH 3/6] Support saml2 attributes --- lib/Saml2/Response.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Saml2/Response.php b/lib/Saml2/Response.php index 2c460f94..eb12d01a 100644 --- a/lib/Saml2/Response.php +++ b/lib/Saml2/Response.php @@ -447,7 +447,7 @@ public function getAttributes() $attributeValues = array(); foreach ($entry->childNodes as $childNode) { - if ($childNode->nodeType == XML_ELEMENT_NODE && $childNode->tagName === 'saml:AttributeValue') { + if ($childNode->nodeType == XML_ELEMENT_NODE && ($childNode->tagName === 'saml:AttributeValue' || $childNode->tagName === 'saml2:AttributeValue')) { $attributeValues[] = $childNode->nodeValue; } } From 3f05e6b2e953b74997f1f1e3931992c77d98b62d Mon Sep 17 00:00:00 2001 From: Jonathan Warner Date: Thu, 10 Jul 2014 14:25:33 -0400 Subject: [PATCH 4/6] Make validUntil and cacheDuration configurable --- lib/Saml2/Settings.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Saml2/Settings.php b/lib/Saml2/Settings.php index 5172a8bb..a954f4f9 100644 --- a/lib/Saml2/Settings.php +++ b/lib/Saml2/Settings.php @@ -339,6 +339,13 @@ private function _addDefaultValues() if (!isset($this->_sp['privateKey'])) { $this->_sp['privateKey'] = ''; } + + if (!isset($this->_sp['validUntil'])) { + $this->_sp['validUntil'] = null; + } + if (!isset($this->_sp['cacheDuration'])) { + $this->_sp['cacheDuration'] = null; + } } /** @@ -591,7 +598,7 @@ public function getOrganization() */ public function getSPMetadata() { - $metadata = OneLogin_Saml2_Metadata::builder($this->_sp, $this->_security['authnRequestsSigned'], $this->_security['wantAssertionsSigned'], null, null, $this->getContacts(), $this->getOrganization()); + $metadata = OneLogin_Saml2_Metadata::builder($this->_sp, $this->_security['authnRequestsSigned'], $this->_security['wantAssertionsSigned'], $this->_sp['validUntil'], $this->_sp['cacheDuration'], $this->getContacts(), $this->getOrganization()); $cert = $this->getSPcert(); From 5a75691cba1699c6d08e23d4ca6f860d1b58e8d0 Mon Sep 17 00:00:00 2001 From: Jonathan Warner Date: Mon, 28 Jul 2014 12:36:34 -0400 Subject: [PATCH 5/6] Add support for UI logos in Shibboleth --- lib/Saml2/Metadata.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/Saml2/Metadata.php b/lib/Saml2/Metadata.php index bf0a34e2..ceaee3d4 100644 --- a/lib/Saml2/Metadata.php +++ b/lib/Saml2/Metadata.php @@ -84,6 +84,19 @@ public static function builder($sp, $authnsign = false, $wsign = false, $validUn $strContacts = implode("\n", $contactsInfo); } + $extensions = ''; + if (isset($sp['uiInfo'])) + { + $extensions = << + + {$sp['uiInfo']['displayName']} + {$sp['uiInfo']['logo']} + + +EXTENSIONS; + } + $metadata = << {$sls} +{$extensions} {$strOrganization} {$strContacts} From 790e48df4a9fa1799f3f4132523985f6fc9c9e35 Mon Sep 17 00:00:00 2001 From: Jonathan Warner Date: Fri, 2 Oct 2015 11:52:31 -0400 Subject: [PATCH 6/6] Remove the default validUntil and cacheDuration times These are not needed and should not be filled in if the configuration does not request it. --- lib/Saml2/Metadata.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/Saml2/Metadata.php b/lib/Saml2/Metadata.php index ceaee3d4..210c9486 100644 --- a/lib/Saml2/Metadata.php +++ b/lib/Saml2/Metadata.php @@ -26,13 +26,9 @@ class OneLogin_Saml2_Metadata public static function builder($sp, $authnsign = false, $wsign = false, $validUntil = null, $cacheDuration = null, $contacts = array(), $organization = array()) { - if (!isset($validUntil)) { - $validUntil = time() + self::TIME_VALID; - } - $validUntilTime = gmdate('Y-m-d\TH:i:s\Z', $validUntil); - - if (!isset($cacheDuration)) { - $cacheDuration = time() + self::TIME_CACHED; + $validUntilTime = null; + if (isset($validUntil)) { + $validUntilTime = gmdate('Y-m-d\TH:i:s\Z', $validUntil); } $sls = ''; @@ -97,12 +93,21 @@ public static function builder($sp, $authnsign = false, $wsign = false, $validUn EXTENSIONS; } + $validUntilString = ""; + $cacheDurationString = ""; + if ($validUntilTime) { + $validUntilString = "validUntil=\"{$validUntilTime}\""; + } + if ($cacheDuration) { + $cacheDurationString = "cacheDuration=\"PT{$cacheDuration}S\""; + } + $metadata = << + {$validUntilString} + {$cacheDurationString} + entityID="{$sp['entityId']}"> {$sp['NameIDFormat']}