so no xml/text header in SLO

This commit is contained in:
Valentin Samir 2015-06-04 14:48:07 +02:00
parent f1fbdd3653
commit cd79935435

View file

@ -331,7 +331,7 @@ class Ticket(models.Model):
def logout(self, request, session): def logout(self, request, session):
"""Send a SLO request to the ticket service""" """Send a SLO request to the ticket service"""
if self.validate and self.single_log_out: if self.validate and self.single_log_out:
xml = """<samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xml = u"""<samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
ID="%(id)s" Version="2.0" IssueInstant="%(datetime)s"> ID="%(id)s" Version="2.0" IssueInstant="%(datetime)s">
<saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"></saml:NameID> <saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"></saml:NameID>
<samlp:SessionIndex>%(ticket)s</samlp:SessionIndex> <samlp:SessionIndex>%(ticket)s</samlp:SessionIndex>
@ -341,12 +341,10 @@ class Ticket(models.Model):
'datetime' : timezone.now().isoformat(), 'datetime' : timezone.now().isoformat(),
'ticket': self.value 'ticket': self.value
} }
headers = {'Content-Type': 'text/xml'}
try: try:
return session.post( return session.post(
self.service.encode('utf-8'), self.service.encode('utf-8'),
data={'logoutRequest':xml.encode('utf-8')}, data={'logoutRequest':xml.encode('utf-8')},
headers=headers
) )
except Exception as error: except Exception as error:
if request is not None: if request is not None: