Return Idps metadata file on request
authorSimo Sorce <simo@redhat.com>
Mon, 7 Apr 2014 22:41:12 +0000 (18:41 -0400)
committerSimo Sorce <simo@redhat.com>
Fri, 11 Apr 2014 21:25:54 +0000 (17:25 -0400)
Signed-off-by: Simo Sorce <simo@redhat.com>
ipsilon/providers/saml2idp.py

index f37474d..0c8358d 100755 (executable)
@@ -98,10 +98,21 @@ class SSO(ProviderPageBase):
         self.Continue = Continue(*args, **kwargs)
 
 
+class Metadata(ProviderPageBase):
+    def GET(self, *args, **kwargs):
+        with open(self.cfg.idp_metadata_file) as m:
+            body = m.read()
+        cherrypy.response.headers["Content-Type"] = "text/xml"
+        cherrypy.response.headers["Content-Disposition"] = \
+            'attachment; filename="metadata.xml"'
+        return body
+
+
 class SAML2(ProviderPageBase):
 
     def __init__(self, *args, **kwargs):
         super(SAML2, self).__init__(*args, **kwargs)
+        self.metadata = Metadata(*args, **kwargs)
 
         # Init IDP data
         try: