diff options
author | Olav Morken <olav.morken@uninett.no> | 2012-02-16 07:30:11 +0000 |
---|---|---|
committer | Olav Morken <olav.morken@uninett.no> | 2012-02-16 07:30:11 +0000 |
commit | 85fa459101173475ffbf5e0b67cccbaa1773d78c (patch) | |
tree | 81a7fc3e30e50e0516c9208ad6c716d20c84bd50 /lib/SimpleSAML/Metadata/SAMLParser.php | |
parent | f2fa425aac762a490dbbf2d8d208ba604f713fe4 (diff) | |
download | simplesamlphp-85fa459101173475ffbf5e0b67cccbaa1773d78c.zip simplesamlphp-85fa459101173475ffbf5e0b67cccbaa1773d78c.tar.gz simplesamlphp-85fa459101173475ffbf5e0b67cccbaa1773d78c.tar.bz2 |
Ignore cacheDuration when evaluating validity of metadata.
Thanks to Thijs Kinkhorst for providing this patch.
git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3034 44740490-163a-0410-bde0-09ae8108e29a
Diffstat (limited to 'lib/SimpleSAML/Metadata/SAMLParser.php')
-rw-r--r-- | lib/SimpleSAML/Metadata/SAMLParser.php | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php index 62d37f3..f5e089d 100644 --- a/lib/SimpleSAML/Metadata/SAMLParser.php +++ b/lib/SimpleSAML/Metadata/SAMLParser.php @@ -342,11 +342,8 @@ class SimpleSAML_Metadata_SAMLParser { /** * Determine how long a given element can be cached. * - * This function looks for the 'cacheDuration' and 'validUntil' attributes to determine - * how long a given XML-element is valid. It returns this as na unix timestamp. - * - * If both the 'cacheDuration' and 'validUntil' attributes are present, the shorter of them - * will be returned. + * This function looks for the 'validUntil' attribute to determine + * how long a given XML-element is valid. It returns this as a unix timestamp. * * @param mixed $element The element we should determine the expiry time of. * @param int|NULL $maxExpireTime The maximum expiration time. @@ -354,22 +351,13 @@ class SimpleSAML_Metadata_SAMLParser { * limit is set for the element. */ private static function getExpireTime($element, $maxExpireTime) { + /* validUntil may be NULL */ + $expire = $element->validUntil; - if ($element->cacheDuration !== NULL) { - $expire = SimpleSAML_Utilities::parseDuration($element->cacheDuration, time()); - if ($maxExpireTime !== NULL && $maxExpireTime < $expire) { - $expire = $maxExpireTime; - } - } else { + if ( $maxExpireTime !== NULL && ($expire === NULL || $maxExpireTime < $expire) ) { $expire = $maxExpireTime; } - if ($element->validUntil !== NULL) { - if ($expire === NULL || $expire > $element->validUntil) { - $expire = $element->validUntil; - } - } - return $expire; } |