@@ -246,15 +246,16 @@ def get(self, request, *args, **kwargs):
246
246
sso_kwargs ['nsprefix' ] = get_namespace_prefixes ()
247
247
248
248
logger .debug (f'Redirecting user to the IdP via { binding } binding.' )
249
+ _msg = 'Unable to know which IdP to use'
249
250
if binding == saml2 .BINDING_HTTP_REDIRECT :
250
251
try :
251
252
session_id , result = client .prepare_for_authenticate (
252
253
entityid = selected_idp , relay_state = next_path ,
253
254
binding = binding , sign = sign_requests ,
254
255
** sso_kwargs )
255
256
except TypeError as e :
256
- logger .error ('Unable to know which IdP to use ' )
257
- return HttpResponse (str ( e ) )
257
+ logger .error (f' { _msg } : { e } ' )
258
+ return HttpResponse (_msg )
258
259
else :
259
260
http_response = HttpResponseRedirect (get_location (result ))
260
261
elif binding == saml2 .BINDING_HTTP_POST :
@@ -263,8 +264,8 @@ def get(self, request, *args, **kwargs):
263
264
try :
264
265
location = client .sso_location (selected_idp , binding )
265
266
except TypeError as e :
266
- logger .error ('Unable to know which IdP to use ' )
267
- return HttpResponse (str ( e ) )
267
+ logger .error (f' { _msg } : { e } ' )
268
+ return HttpResponse (_msg )
268
269
session_id , request_xml = client .create_authn_request (
269
270
location ,
270
271
binding = binding ,
@@ -293,8 +294,9 @@ def get(self, request, *args, **kwargs):
293
294
entityid = selected_idp , relay_state = next_path ,
294
295
binding = binding )
295
296
except TypeError as e :
296
- logger .error ('Unable to know which IdP to use' )
297
- return HttpResponse (str (e ))
297
+ _msg = f"Can't prepare the authentication for { selected_idp } "
298
+ logger .error (f'{ _msg } : { e } ' )
299
+ return HttpResponse (_msg )
298
300
else :
299
301
http_response = HttpResponse (result ['data' ])
300
302
else :
0 commit comments