Cómo configurar una estrategia de sesión inválida personalizada en Spring Security

Estoy desarrollando una aplicación web, basada en Spring-Boot - 1.1.6, Spring -Security -3.2.5 y más.

Estoy usando la configuración basada en Java:

@Configuration
@EnableWebMvcSecurity
public class SecurityCtxConfig extends WebSecurityConfigurerAdapter {


    @Bean
    DelegatingAuthenticationEntryPoint delegatingAuthenticationEntryPoint() {
        LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> map = new LinkedHashMap<RequestMatcher, AuthenticationEntryPoint>();
        Http403ForbiddenEntryPoint defaultEntryPoint = new Http403ForbiddenEntryPoint();
        map.put(AnyRequestMatcher.INSTANCE, defaultEntryPoint);
        DelegatingAuthenticationEntryPoint retVal = new DelegatingAuthenticationEntryPoint(map);
        retVal.setDefaultEntryPoint(defaultEntryPoint);
        return retVal;
    }


    @Override
    protected void configure(HttpSecurity http) throws Exception {
        ExceptionHandlingConfigurer<HttpSecurity> exceptionHandling = http.exceptionHandling();
        exceptionHandling.authenticationEntryPoint(delegatingAuthenticationEntryPoint());
        http.logout().logoutSuccessHandler(new LogoutSuccessHandler() {

            @Override
            public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication arg2)
                    throws IOException, ServletException {
                response.setStatus(HttpServletResponse.SC_OK);
            }
        });
    }

}

El requisito es devolver el estado Http 401 en caso de que la cookie de sesión no sea válida o falte (sin importar el motivo).InvalidSessionStrategy pero no encuentro una manera de configurarlo en elSessionManagementFilter. ¿Puede alguien, por favor, inscribirme cómo implementar mi plan u otro que cumpla con el requisito?

Respuestas a la pregunta(3)

Su respuesta a la pregunta