@@ -82,7 +82,10 @@ def get_sp_config(self, request: HttpRequest) -> SPConfig:
8282 def get_state_client (self , request : HttpRequest ):
8383 conf = self .get_sp_config (request )
8484 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+ )
8689 return state , client
8790
8891
@@ -466,7 +469,7 @@ def get(self, request, *args, **kwargs):
466469 logger .exception ('Error Handled - SLO not supported by IDP: {}' .format (exp ))
467470 auth .logout (request )
468471 state .sync ()
469- return HttpResponseRedirect (settings . LOGOUT_REDIRECT_URL )
472+ return HttpResponseRedirect (getattr ( settings , ' LOGOUT_REDIRECT_URL' , '/' ) )
470473
471474 auth .logout (request )
472475 state .sync ()
@@ -567,8 +570,8 @@ def do_logout_service(self, request, data, binding):
567570
568571def finish_logout (request , response , next_page = None ):
569572 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' , '/' )
572575 logger .debug ('Performing django logout with a next_page of %s' , next_page )
573576 return AuthLogoutView .as_view ()(request , next_page = next_page )
574577 logger .error ('Unknown error during the logout' )
0 commit comments