set IssueInstant and ResponseID on saml error

This commit is contained in:
Valentin Samir 2015-05-28 15:17:11 +02:00
parent 871baaac87
commit 5ebc5169c3
2 changed files with 10 additions and 2 deletions

View file

@ -68,3 +68,6 @@ def gen_pgtiou():
"""Generate a Proxy Granting Ticket IOU""" """Generate a Proxy Granting Ticket IOU"""
return _gen_ticket('PGTIOU') return _gen_ticket('PGTIOU')
def gen_saml_id():
return _gen_ticket('_')

View file

@ -403,7 +403,12 @@ def _saml_validate_error(request, code, msg=""):
return render( return render(
request, request,
"cas_server/samlValidateError.xml", "cas_server/samlValidateError.xml",
{'code':code, 'msg':msg}, {
'code':code,
'msg':msg,
'IssueInstant':timezone.now().isoformat(),
'ResponseID':utils.gen_saml_id()
},
content_type="text/xml; charset=utf-8" content_type="text/xml; charset=utf-8"
) )
@ -457,7 +462,7 @@ def saml_validate(request):
'IssueInstant':issue_instant, 'IssueInstant':issue_instant,
'expireInstant':expire_instant, 'expireInstant':expire_instant,
'Recipient':target, 'Recipient':target,
'ResponseID':request_id, 'ResponseID':utils.gen_saml_id(),
'username':ticket.user.username, 'username':ticket.user.username,
'attributes':attributes 'attributes':attributes
} }