@@ -82,7 +82,10 @@ def get_sp_config(self, request: HttpRequest) -> SPConfig:
82
82
def get_state_client (self , request : HttpRequest ):
83
83
conf = self .get_sp_config (request )
84
84
state = StateCache (request .saml_session )
85
- client = Saml2Client (conf , state_cache = state , identity_cache = IdentityCache (request .saml_session ))
85
+ client = Saml2Client (
86
+ conf , state_cache = state ,
87
+ identity_cache = IdentityCache (request .saml_session )
88
+ )
86
89
return state , client
87
90
88
91
@@ -466,7 +469,7 @@ def get(self, request, *args, **kwargs):
466
469
logger .exception ('Error Handled - SLO not supported by IDP: {}' .format (exp ))
467
470
auth .logout (request )
468
471
state .sync ()
469
- return HttpResponseRedirect (settings . LOGOUT_REDIRECT_URL )
472
+ return HttpResponseRedirect (getattr ( settings , ' LOGOUT_REDIRECT_URL' , '/' ) )
470
473
471
474
auth .logout (request )
472
475
state .sync ()
@@ -567,8 +570,8 @@ def do_logout_service(self, request, data, binding):
567
570
568
571
def finish_logout (request , response , next_page = None ):
569
572
if (getattr (settings , 'SAML_IGNORE_LOGOUT_ERRORS' , False ) or (response and response .status_ok ())):
570
- if next_page is None and hasattr ( settings , 'LOGOUT_REDIRECT_URL' ) :
571
- next_page = settings . LOGOUT_REDIRECT_URL
573
+ if not next_page :
574
+ next_page = getattr ( settings , ' LOGOUT_REDIRECT_URL' , '/' )
572
575
logger .debug ('Performing django logout with a next_page of %s' , next_page )
573
576
return AuthLogoutView .as_view ()(request , next_page = next_page )
574
577
logger .error ('Unknown error during the logout' )
0 commit comments