如果我清除了浏览器历史记录,则春季安全会话未清除,则会显示以下错误:
org.springframework.security.web.authentication.session.SessionAuthenticationException: 超过此委托人的最大会话数为1。
但我需要最大会话应该是1.这是我的配置代码
@Override
protected void configure(HttpSecurity http) throws Exception {
http.headers().frameOptions().disable().
authorizeRequests()
.antMatchers("/admin/**").access("hasRole('FULL ACCESS')")
.antMatchers("/companymaster/**").access("hasRole('FULL ACCESS')")
.antMatchers("/AccountSetting/**").access("hasRole('FULL ACCESS')")
.antMatchers("/","/dashboard/**").access("hasRole('FULL ACCESS') or hasRole('LIMITTED ACCESS')")
.and()
.formLogin().loginPage("/login").failureUrl("/login?error").successHandler(customAuthenticatonSuccessHandler)
.usernameParameter("username")
.passwordParameter("password")
.and().logout().logoutSuccessUrl("/login?logout").invalidateHttpSession(true)
.deleteCookies("JSESSIONID")
.permitAll()
.and().csrf()
.and().exceptionHandling().accessDeniedPage("/403")
.and()
.sessionManagement()
.sessionFixation().changeSessionId()
.invalidSessionUrl("/login?invalid")
.maximumSessions(1)
.maxSessionsPreventsLogin(true)
.expiredUrl("/login?expired")
.sessionRegistry(sessionRegistry());
}