Skip to content

Commit 1bb7cba

Browse files
committed
Add error reason
1 parent 7ab2cd8 commit 1bb7cba

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

demo_pyramid/demo_pyramid/templates/index.jinja2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
{% for err in errors %}
1515
<li>{{err}}</li>
1616
{% endfor %}
17-
</ul>
17+
Reason: {{ error_reason }}
18+
</ul>
1819
</div>
1920
{% endif %}
2021

demo_pyramid/demo_pyramid/views.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def index(request):
3333
req = prepare_pyramid_request(request)
3434
auth = init_saml_auth(req)
3535
errors = []
36+
error_reason = ""
3637
not_auth_warn = False
3738
success_slo = False
3839
attributes = False
@@ -65,6 +66,8 @@ def index(request):
6566
self_url = OneLogin_Saml2_Utils.get_self_url(req)
6667
if 'RelayState' in request.POST and self_url != request.POST['RelayState']:
6768
return HTTPFound(auth.redirect_to(request.POST['RelayState']))
69+
else:
70+
error_reason = auth.get_last_error_reason()
6871
elif 'sls' in request.GET:
6972
dscb = lambda: session.clear()
7073
url = auth.process_slo(delete_session_cb=dscb)
@@ -82,6 +85,7 @@ def index(request):
8285

8386
return {
8487
'errors': errors,
88+
'error_reason': error_reason,
8589
'not_auth_warn': not_auth_warn,
8690
'success_slo': success_slo,
8791
'attributes': attributes,

0 commit comments

Comments
 (0)