@@ -34,6 +34,7 @@ def index(request):
3434 req = prepare_django_request (request )
3535 auth = init_saml_auth (req )
3636 errors = []
37+ error_reason = None
3738 not_auth_warn = False
3839 success_slo = False
3940 attributes = False
@@ -70,6 +71,7 @@ def index(request):
7071 auth .process_response (request_id = request_id )
7172 errors = auth .get_errors ()
7273 not_auth_warn = not auth .is_authenticated ()
74+
7375 if not errors :
7476 if 'AuthNRequestID' in request .session :
7577 del request .session ['AuthNRequestID' ]
@@ -78,6 +80,9 @@ def index(request):
7880 request .session ['samlSessionIndex' ] = auth .get_session_index ()
7981 if 'RelayState' in req ['post_data' ] and OneLogin_Saml2_Utils .get_self_url (req ) != req ['post_data' ]['RelayState' ]:
8082 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 ()
8186 elif 'sls' in req ['get_data' ]:
8287 request_id = None
8388 if 'LogoutRequestID' in request .session :
@@ -96,7 +101,7 @@ def index(request):
96101 if len (request .session ['samlUserdata' ]) > 0 :
97102 attributes = request .session ['samlUserdata' ].items ()
98103
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 ,
100105 'attributes' : attributes , 'paint_logout' : paint_logout })
101106
102107
0 commit comments