Revision: 3034
Author: olavmrk
Date: Wed Feb 15 23:30:11 2012
Log: Ignore cacheDuration when evaluating validity of metadata.
Thanks to Thijs Kinkhorst for providing this patch.
http://code.google.com/p/simplesamlphp/source/detail?r=3034
Modified:
/trunk/docs/simplesamlphp-automated_metadata.txt
/trunk/lib/SimpleSAML/Metadata/SAMLParser.php
/trunk/modules/aggregator2/lib/EntitySource.php
=======================================
--- /trunk/docs/simplesamlphp-automated_metadata.txt Mon Mar 8 02:14:12
2010
+++ /trunk/docs/simplesamlphp-automated_metadata.txt Wed Feb 15 23:30:11
2012
@@ -224,4 +224,8 @@
),
-
+Metadata cacheDuration
+----------------------
+
+SAML metadata may supply a cacheDuration attribute which indicates the
maxium time to cache metadata. Because this module is run from cron, it
cannot influence how often it is run and enfore this attribute by itself.
Take care that you run metarefresh from cron at least as often as the
shortest cacheDuration in your metadata sources.
+
=======================================
--- /trunk/lib/SimpleSAML/Metadata/SAMLParser.php Wed Mar 9 01:07:54 2011
+++ /trunk/lib/SimpleSAML/Metadata/SAMLParser.php Wed Feb 15 23:30:11 2012
@@ -342,11 +342,8 @@
/**
* 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,21 +351,12 @@
* limit is set for the element.
*/
private static function getExpireTime($element, $maxExpireTime) {
-
- if ($element->cacheDuration !== NULL) {
- $expire = SimpleSAML_Utilities::parseDuration($element->cacheDuration,
time());
- if ($maxExpireTime !== NULL && $maxExpireTime <
$expire) {
- $expire = $maxExpireTime;
- }
- } else {
+ /* validUntil may be NULL */
+ $expire = $element->validUntil;
+
+ if ( $maxExpireTime !== NULL && ($expire === NULL || $maxExpireTime <
$expire) ) {
$expire = $maxExpireTime;
}
-
- if ($element->validUntil !== NULL) {
- if ($expire === NULL || $expire > $element->validUntil)
{
- $expire = $element->validUntil;
- }
- }
return $expire;
}
=======================================
--- /trunk/modules/aggregator2/lib/EntitySource.php Tue Nov 30 02:06:37 2010
+++ /trunk/modules/aggregator2/lib/EntitySource.php Wed Feb 15 23:30:11 2012
@@ -208,19 +208,6 @@
if ($this->metadata->validUntil !== NULL && $this->metadata->validUntil
< $expires) {
$expires = $this->metadata->validUntil;
}
-
- if ($this->metadata->cacheDuration !== NULL) {
- try {
- $durationTo =
SimpleSAML_Utilities::parseDuration($this->metadata->cacheDuration);
- } catch (Exception $e) {
- SimpleSAML_Logger::warning($this->logLoc . 'Invalid cacheDuration in
metadata from ' .
- var_export($this->url, TRUE) . ': ' .
var_export($this->metadata->cacheDuration, TRUE));
- return;
- }
- if ($durationTo < $expires) {
- $expires = $durationTo;
- }
- }
$metadataSerialized = serialize($this->metadata);
--
You received this message because you are subscribed to the Google Groups
"simpleSAMLphp commits" group.
To post to this group, send email to simplesamlphp-commits@googlegroups.com.
To unsubscribe from this group, send email to
simplesamlphp-commits+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/simplesamlphp-commits?hl=en.