Skip to content

Commit 218cb49

Browse files
committed
Update demos
1 parent cee2250 commit 218cb49

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

demo-django/demo/views.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ def index(request):
8686
request.session['samlSessionIndex'] = auth.get_session_index()
8787
if 'RelayState' in req['post_data'] and OneLogin_Saml2_Utils.get_self_url(req) != req['post_data']['RelayState']:
8888
return HttpResponseRedirect(auth.redirect_to(req['post_data']['RelayState']))
89-
else:
90-
if auth.get_settings().is_debug_active():
89+
elif auth.get_settings().is_debug_active():
9190
error_reason = auth.get_last_error_reason()
9291
elif 'sls' in req['get_data']:
9392
request_id = None
@@ -101,6 +100,8 @@ def index(request):
101100
return HttpResponseRedirect(url)
102101
else:
103102
success_slo = True
103+
elif auth.get_settings().is_debug_active():
104+
error_reason = auth.get_last_error_reason()
104105

105106
if 'samlUserdata' in request.session:
106107
paint_logout = True

demo-django/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Django==1.11
1+
Django==1.11.26
22
python3-saml

demo-flask/index.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def index():
3939
req = prepare_flask_request(request)
4040
auth = init_saml_auth(req)
4141
errors = []
42+
error_reason = None
4243
not_auth_warn = False
4344
success_slo = False
4445
attributes = False
@@ -86,6 +87,8 @@ def index():
8687
self_url = OneLogin_Saml2_Utils.get_self_url(req)
8788
if 'RelayState' in request.form and self_url != request.form['RelayState']:
8889
return redirect(auth.redirect_to(request.form['RelayState']))
90+
elif auth.get_settings().is_debug_active():
91+
error_reason = auth.get_last_error_reason()
8992
elif 'sls' in request.args:
9093
request_id = None
9194
if 'LogoutRequestID' in session:
@@ -98,6 +101,8 @@ def index():
98101
return redirect(url)
99102
else:
100103
success_slo = True
104+
elif auth.get_settings().is_debug_active():
105+
error_reason = auth.get_last_error_reason()
101106

102107
if 'samlUserdata' in session:
103108
paint_logout = True
@@ -107,6 +112,7 @@ def index():
107112
return render_template(
108113
'index.html',
109114
errors=errors,
115+
error_reason=error_reason,
110116
not_auth_warn=not_auth_warn,
111117
success_slo=success_slo,
112118
attributes=attributes,

demo-flask/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
flask==0.10.1
1+
flask==1.0

demo-flask/templates/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
<li>{{err}}</li>
1111
{% endfor %}
1212
</ul>
13+
{% if error_reason %}
14+
<span>{{error_reason}}</span>
15+
{% endif %}
1316
</div>
1417
{% endif %}
1518

0 commit comments

Comments
 (0)