diff --git a/mellon/views.py b/mellon/views.py index afccb69..b38fb44 100644 --- a/mellon/views.py +++ b/mellon/views.py @@ -231,6 +231,8 @@ class LoginView(ProfileMixin, LogMixin, View): ): self.show_message_status_is_not_success(login, 'SAML authentication failed') except lasso.Error as e: + if self.debug_login: + return self.render_debug_template(request, login) return HttpResponseBadRequest('error processing the authentication response: %r' % e) else: if 'RelayState' in request.POST and utils.is_nonnull(request.POST['RelayState']): @@ -315,7 +317,7 @@ class LoginView(ProfileMixin, LogMixin, View): return HttpResponseRedirect(next_url) - def render_debug_template(self, request, login, attributes): + def render_debug_template(self, request, login, attributes=None): request.session['mellon_debug_login'] = False context = { 'logs': self.stream.getvalue(), diff --git a/tests/test_sso_slo.py b/tests/test_sso_slo.py index 0968039..b01c68e 100644 --- a/tests/test_sso_slo.py +++ b/tests/test_sso_slo.py @@ -21,6 +21,7 @@ import urllib.parse as urlparse import xml.etree.ElementTree as ET import zlib from html import unescape +from unittest import mock import lasso import pytest @@ -776,6 +777,22 @@ def test_debug_sso(db, app, idp, caplog, sp_settings, settings): assert '