File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 2828from django .template import TemplateDoesNotExist
2929from django .utils .http import is_safe_url
3030from django .views .decorators .csrf import csrf_exempt
31- from django .views .decorators .http import require_POST
32- from saml2 import BINDING_HTTP_POST , BINDING_HTTP_REDIRECT
31+ from saml2 import BINDING_HTTP_REDIRECT , BINDING_HTTP_POST
32+ from saml2 .client_base import LogoutError
33+ from saml2 .metadata import entity_descriptor
3334from saml2 .ident import code , decode
3435from saml2 .metadata import entity_descriptor
3536from saml2 .response import (SignatureError , StatusAuthnFailed , StatusError ,
@@ -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
You can’t perform that action at this time.
0 commit comments