Как заменить redirectStrategy в ConcurrentSessionFilter - PullRequest
0 голосов
/ 29 августа 2018

Я использую Spring Security 3.2.7. Существующий ConcurrentSessionFilter перенаправляет запрос, когда sessionExpires. Я хотел бы изменить и переслать этот запрос на пользовательский контроллер. Как мне этого добиться? Я настроил ConcurrentSessionFilter вручную и добавил его в конфигурацию Spring. Это приводит к двойному вызову фильтра.

Ниже приведена конфигурация безопасности пружины:

@Bean
public ConcurrentSessionFilter getConcurrentSessionFilter() {
    RedirectStrategy redirectStrategy = new 
    CustomSessionRedirectStrategy(true, false);
    ConcurrentSessionFilter concurrentSessionFilter = new ConcurrentSessionFilter(getSessionRegistry(),SESSION_EXPIRED_REDIRECT_END_POINT);

    concurrentSessionFilter.setRedirectStrategy(redirectStrategy);
    concurrentSessionFilter.afterPropertiesSet();

    return concurrentSessionFilter;
}

protected void configure(HttpSecurity http) throws Exception{
    /****/
    .sessionManagement()
    .sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
    .maximumSessions(1)
    .maxSessionsPreventsLogin(false)
    .sessionRegistry(getSessionRegistry())

    .and()
        /****/
    .addFilterBefore(getConcurrentSessionFilter(), ConcurrentSessionFilter.class)
        /***/
}

Любая помощь очень ценится.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...