Skip to content

Commit b14904a

Browse files
committed
Fix IDP POST response for IDP initialized logout request (for SLO)
1 parent 6439697 commit b14904a

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
@@ -458,7 +458,17 @@ def do_logout_service(request, data, binding, config_loader_path=None, next_page
458458
relay_state=data.get('RelayState', ''))
459459
state.sync()
460460
auth.logout(request)
461-
return HttpResponseRedirect(get_location(http_info))
461+
if (
462+
http_info.get('method', 'GET') == 'POST' and
463+
'data' in http_info and
464+
('Content-type', 'text/html') in http_info.get('headers', [])
465+
):
466+
# need to send back to the IDP a signed POST response with user session
467+
# return HTML form content to browser with auto form validation
468+
# to finally send request to the IDP
469+
return HttpResponse(http_info['data'])
470+
else:
471+
return HttpResponseRedirect(get_location(http_info))
462472
else:
463473
logger.error('No SAMLResponse or SAMLRequest parameter found')
464474
raise Http404('No SAMLResponse or SAMLRequest parameter found')

0 commit comments

Comments
 (0)