Skip to content

Commit be87165

Browse files
authored
Merge pull request #163 from DylannCordel/SLO-Redirect
Fix IDP POST response for IDP initialized logout request (for SLO)
2 parents b2c266f + b14904a commit be87165

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

djangosaml2/views.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,17 @@ def do_logout_service(request, data, binding, config_loader_path=None, next_page
466466
relay_state=data.get('RelayState', ''))
467467
state.sync()
468468
auth.logout(request)
469-
return HttpResponseRedirect(get_location(http_info))
469+
if (
470+
http_info.get('method', 'GET') == 'POST' and
471+
'data' in http_info and
472+
('Content-type', 'text/html') in http_info.get('headers', [])
473+
):
474+
# need to send back to the IDP a signed POST response with user session
475+
# return HTML form content to browser with auto form validation
476+
# to finally send request to the IDP
477+
return HttpResponse(http_info['data'])
478+
else:
479+
return HttpResponseRedirect(get_location(http_info))
470480
else:
471481
logger.error('No SAMLResponse or SAMLRequest parameter found')
472482
raise Http404('No SAMLResponse or SAMLRequest parameter found')

0 commit comments

Comments
 (0)