Skip to content
Snippets Groups Projects
Commit eaeaed0a authored by Thijs Kinkhorst's avatar Thijs Kinkhorst
Browse files

Add ETag and check for modifiedness of metadata

parent c197e3f5
No related branches found
No related tags found
No related merge requests found
......@@ -106,6 +106,11 @@ class Metadata
$metaxml = substr($metaxml, 0, $i ? $i + 22 : 0);
$response = new Response();
$response->setEtag(hash('sha256', $metaxml));
$response->setPublic();
if ($response->isNotModified($request)) {
return $response;
}
$response->headers->set('Content-Type', 'application/samlmetadata+xml');
$response->headers->set('Content-Disposition', 'attachment; filename="idp-metadata.xml"');
$response->setContent($metaxml);
......
......@@ -607,6 +607,11 @@ class ServiceProvider
$metaxml = substr($metaxml, 0, $i ? $i + 22 : 0);
$response = new Response();
$response->setEtag(hash('sha256', $metaxml));
$response->setPublic();
if ($response->isNotModified($request)) {
return $response;
}
$response->headers->set('Content-Type', 'application/samlmetadata+xml');
$response->headers->set('Content-Disposition', 'attachment; filename="' . basename($sourceId) . '.xml"');
$response->setContent($metaxml);
......
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