@@ -3022,14 +3022,15 @@ public final class LogoutSpec {
30223022
30233023		private  final  SecurityContextServerLogoutHandler  DEFAULT_LOGOUT_HANDLER  = new  SecurityContextServerLogoutHandler ();
30243024
3025- 		private  List <ServerLogoutHandler > logoutHandlers  = new  ArrayList <>(Arrays . asList ( this . DEFAULT_LOGOUT_HANDLER ) );
3025+ 		private  List <ServerLogoutHandler > logoutHandlers  = new  ArrayList <>();
30263026
30273027		private  LogoutSpec () {
30283028		}
30293029
30303030		/** 
30313031		 * Configures the logout handler. Default is 
3032- 		 * {@code SecurityContextServerLogoutHandler} 
3032+ 		 * {@code SecurityContextServerLogoutHandler}. This clears any previous handlers 
3033+ 		 * configured. 
30333034		 * @param logoutHandler 
30343035		 * @return the {@link LogoutSpec} to configure 
30353036		 */ 
@@ -3039,7 +3040,12 @@ public LogoutSpec logoutHandler(ServerLogoutHandler logoutHandler) {
30393040			return  addLogoutHandler (logoutHandler );
30403041		}
30413042
3042- 		private  LogoutSpec  addLogoutHandler (ServerLogoutHandler  logoutHandler ) {
3043+ 		/** 
3044+ 		 * Adds a logout handler in the last position. 
3045+ 		 * @param logoutHandler 
3046+ 		 * @return the {@link LogoutSpec} to configure 
3047+ 		 */ 
3048+ 		public  LogoutSpec  addLogoutHandler (ServerLogoutHandler  logoutHandler ) {
30433049			Assert .notNull (logoutHandler , "logoutHandler cannot be null" );
30443050			this .logoutHandlers .add (logoutHandler );
30453051			return  this ;
@@ -3088,7 +3094,7 @@ private ServerLogoutHandler createLogoutHandler() {
30883094				this .DEFAULT_LOGOUT_HANDLER .setSecurityContextRepository (securityContextRepository );
30893095			}
30903096			if  (this .logoutHandlers .isEmpty ()) {
3091- 				return  null ;
3097+ 				return  DEFAULT_LOGOUT_HANDLER ;
30923098			}
30933099			if  (this .logoutHandlers .size () == 1 ) {
30943100				return  this .logoutHandlers .get (0 );
0 commit comments