Skip to content

Commit 9aec43e

Browse files
committed
SLO exception workaround
1 parent 6439697 commit 9aec43e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

djangosaml2/views.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from django.views.decorators.csrf import csrf_exempt
3737

3838
from saml2 import BINDING_HTTP_REDIRECT, BINDING_HTTP_POST
39+
from saml2.client_base import LogoutError
3940
from saml2.metadata import entity_descriptor
4041
from saml2.ident import code, decode
4142
from saml2.sigver import MissingKey
@@ -376,7 +377,13 @@ def logout(request, config_loader_path=None):
376377
'The session does not contain the subject id for user %s',
377378
request.user)
378379

379-
result = client.global_logout(subject_id)
380+
try:
381+
result = client.global_logout(subject_id)
382+
except LogoutError as exp:
383+
logger.exception('Error Handled - SLO not supported by IDP: {}'.format(exp))
384+
auth.logout(request)
385+
state.sync()
386+
return HttpResponseRedirect('/')
380387

381388
state.sync()
382389

0 commit comments

Comments
 (0)