@@ -34,6 +34,7 @@ def index(request):
34
34
req = prepare_django_request (request )
35
35
auth = init_saml_auth (req )
36
36
errors = []
37
+ error_reason = None
37
38
not_auth_warn = False
38
39
success_slo = False
39
40
attributes = False
@@ -70,6 +71,7 @@ def index(request):
70
71
auth .process_response (request_id = request_id )
71
72
errors = auth .get_errors ()
72
73
not_auth_warn = not auth .is_authenticated ()
74
+
73
75
if not errors :
74
76
if 'AuthNRequestID' in request .session :
75
77
del request .session ['AuthNRequestID' ]
@@ -78,6 +80,9 @@ def index(request):
78
80
request .session ['samlSessionIndex' ] = auth .get_session_index ()
79
81
if 'RelayState' in req ['post_data' ] and OneLogin_Saml2_Utils .get_self_url (req ) != req ['post_data' ]['RelayState' ]:
80
82
return HttpResponseRedirect (auth .redirect_to (req ['post_data' ]['RelayState' ]))
83
+ else :
84
+ if auth .get_settings ().is_debug_active ():
85
+ error_reason = auth .get_last_error_reason ()
81
86
elif 'sls' in req ['get_data' ]:
82
87
request_id = None
83
88
if 'LogoutRequestID' in request .session :
@@ -96,7 +101,7 @@ def index(request):
96
101
if len (request .session ['samlUserdata' ]) > 0 :
97
102
attributes = request .session ['samlUserdata' ].items ()
98
103
99
- return render (request , 'index.html' , {'errors' : errors , 'not_auth_warn' : not_auth_warn , 'success_slo' : success_slo ,
104
+ return render (request , 'index.html' , {'errors' : errors , 'error_reason' : error_reason , not_auth_warn : not_auth_warn , 'success_slo' : success_slo ,
100
105
'attributes' : attributes , 'paint_logout' : paint_logout })
101
106
102
107
0 commit comments