У меня проблема с конфигурацией Spring Security.Spring Security - несколько зарегистрированных пользователей
Когда я вхожу в систему на одном компьютере в качестве пользователя1, а затем я буду регистрироваться как пользователь2 на другом компьютере, первый компьютер после обновления видит все как пользователь2.
Другими словами, одновременное использование двух сеансов с разными пользователями невозможно.
Конфигурация:
@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
public void configureGlobalSecurity(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("user1").password("user1").roles("USER");
auth.inMemoryAuthentication().withUser("user2").password("user2").roles("USER");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
CharacterEncodingFilter filter = new CharacterEncodingFilter();
filter.setEncoding("UTF-8");
filter.setForceEncoding(true);
http.addFilterBefore(filter,CsrfFilter.class);
http.csrf().disable();
http.authorizeRequests()
.antMatchers("/", "/login").permitAll()
.antMatchers("https://stackoverflow.com/questions/**").access("hasRole('USER')")
.and().formLogin().loginPage("/login").defaultSuccessUrl("/questions")
.usernameParameter("ssoId").passwordParameter("password");
}
Spring Security Версия: 4.0.1.RELEASE
Весна версия: 4.1.6.RELEASE
Логин запрос в контроллере:
@RequestMapping(value = { "/", "/login" }, method = RequestMethod.GET)
public String homePage() {
return "login";
}