Skip to content

Commit 5c1d146

Browse files
committed
Unsupported Binding exception in SLO
There's the possibility that an IdP doesn't support the SLO, added an exception handling as a workaround for this. Now we have in the log something like: ```` Unsupported binding: None (https://172.17.0.1:10000/Saml2IDP/metadata) Error Handled - SLO - unsupported binding by IDP: None Traceback (most recent call last): File "~/DEV/IdentityPython/env/lib/python3.8/site-packages/djangosaml2/views.py", line 601, in get result = client.global_logout(subject_id) File "~/DEV/IdentityPython/env/lib/python3.8/site-packages/saml2/client.py", line 210, in global_logout return self.do_logout( File "~/DEV/IdentityPython/env/lib/python3.8/site-packages/djangosaml2/overrides.py", line 25, in do_logout return super().do_logout(*args, **kwargs) File "~/DEV/IdentityPython/env/lib/python3.8/site-packages/saml2/client.py", line 259, in do_logout bindings_slo_supported = self.metadata.single_logout_service( File "~/DEV/IdentityPython/env/lib/python3.8/site-packages/saml2/mdstore.py", line 1236, in single_logout_service return self.service(entity_id, "%s_descriptor" % typ, File "~/DEV/IdentityPython/env/lib/python3.8/site-packages/saml2/mdstore.py", line 1147, in service raise UnsupportedBinding(binding) saml2.s_utils.UnsupportedBinding: None ````
1 parent b6816ef commit 5c1d146

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

djangosaml2/views.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,18 +596,25 @@ def get(self, request, *args, **kwargs):
596596
logger.warning(
597597
'The session does not contain the subject id for user %s', request.user)
598598

599+
_error = None
599600
try:
600601
result = client.global_logout(subject_id)
601602
except LogoutError as exp:
602603
logger.exception(
603604
'Error Handled - SLO not supported by IDP: {}'.format(exp))
604-
auth.logout(request)
605-
state.sync()
606-
return self.handle_unsupported_slo_exception(request, exp)
605+
_error = exp
606+
except UnsupportedBinding as exp:
607+
logger.exception(
608+
'Error Handled - SLO - unsupported binding by IDP: {}'.format(exp))
609+
_error = exp
607610

608611
auth.logout(request)
609612
state.sync()
610613

614+
if _error:
615+
return self.handle_unsupported_slo_exception(request, _error)
616+
617+
611618
if not result:
612619
logger.error(
613620
"Looks like the user %s is not logged in any IdP/AA", subject_id)

0 commit comments

Comments
 (0)