Весенняя безопасность, время до выхода из системы

#spring #spring-security

#весна #весна-безопасность

Вопрос:

Я не знаю почему, может быть, я пишу неправильный код. Через некоторое время мой веб-сайт выходит из системы. Я написал в

 application.properties
session.timeout.interval = 350000000 and 
session.setMaxInactiveInterval = (60*60*24)
  

в форме HTML я написал

 <form th:action="@{/login}" method="post"
  authentication-success-handler-ref="authenticationSuccessHandler">
  

Мой код в Spring Security:

 public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

@Autowired
private UserDetailsService userDetailsService;

@Autowired
private UserRepository userRepository;

@Autowired
private DataSource dataSource;

@Override
    protected void configure(final HttpSecurity httpSecurity) throws Exception {
        httpSecurity
                .authorizeRequests()
                .antMatchers(HttpMethod.GET, "/registration")
                .permitAll()
                .antMatchers(HttpMethod.POST, "/registration")
                .permitAll()
                .antMatchers("/css/**", "/js/**", "/img/**")
                .permitAll()
                .antMatchers("/cars/**")
                .permitAll()
                .anyRequest().authenticated()
                .and()
                .formLogin()
                .loginPage("/login")
                .defaultSuccessUrl("/")
                .passwordParameter("password")
                .permitAll()

                .and().logout().logoutSuccessUrl("/")
                .and()
                .httpBasic()
                .and()
                .csrf().disable();

            httpSecurity.rememberMe().rememberMeParameter("remember-me")
            .rememberMeCookieName("my-remember-me")
            .tokenRepository(persistentTokenRepository()).tokenValiditySeconds(86400000);



    }

    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {

        auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
    }

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new MyPasswordEncoder();
    }




@Bean
public PersistentTokenRepository persistentTokenRepository() {
    JdbcTokenRepositoryImpl tokenRepository = new JdbcTokenRepositoryImpl();
    tokenRepository.setDataSource(dataSource);
    return tokenRepository;
}
  

Я пытаюсь использовать HttpSecurity.addFilterBefore(authenticationFilter(), UsernamePasswordAuthenticationFilter.class ) но я снова вижу выход из системы

Комментарии:

1. я думаю, вам следует указать продолжительность сеанса в web.xml слишком

2. Я не web.xml , все, что нужно, напишите в application.properties