Skip to content
Snippets Groups Projects
Commit c2915b79 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Add expire with metarefresh module

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1209 44740490-163a-0410-bde0-09ae8108e29a
parent 50f69065
No related branches found
No related tags found
No related merge requests found
......@@ -51,11 +51,13 @@ class sspmod_metarefresh_MetaLoader {
}
$template = NULL;
if (array_key_exists('template', $source)) $template = $source['template'];
$expireDuration = time() + min($this->maxcache, $this->maxduration);
$this->addMetadata($source['src'], $entity->getMetadata1xSP(), 'shib13-sp-remote', $template);
$this->addMetadata($source['src'], $entity->getMetadata1xIdP(), 'shib13-idp-remote', $template);
$this->addMetadata($source['src'], $entity->getMetadata20SP(), 'saml20-sp-remote', $template);
$this->addMetadata($source['src'], $entity->getMetadata20IdP(), 'saml20-idp-remote', $template);
$this->addMetadata($source['src'], $entity->getMetadata1xSP(), 'shib13-sp-remote', $template, $expireDuration);
$this->addMetadata($source['src'], $entity->getMetadata1xIdP(), 'shib13-idp-remote', $template, $expireDuration);
$this->addMetadata($source['src'], $entity->getMetadata20SP(), 'saml20-sp-remote', $template, $expireDuration);
$this->addMetadata($source['src'], $entity->getMetadata20IdP(), 'saml20-idp-remote', $template, $expireDuration);
}
}
......@@ -98,7 +100,7 @@ class sspmod_metarefresh_MetaLoader {
* @param $metadata The metadata.
* @param $type The metadata type.
*/
private function addMetadata($filename, $metadata, $type, $template = NULL) {
private function addMetadata($filename, $metadata, $type, $template = NULL, $expireDuration) {
if($metadata === NULL) {
return;
......@@ -115,6 +117,13 @@ class sspmod_metarefresh_MetaLoader {
if(!array_key_exists($type, $this->metadata)) {
$this->metadata[$type] = array();
}
if (!array_key_exists('expire', $metadata)) {
$metadata['expire'] = $expireDuration;
} else {
if ($expireDuration < $metadata['expire'])
$metadata['expire'] = $expireDuration;
}
$this->metadata[$type][] = array('filename' => $filename, 'metadata' => $metadata);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment