Java 何时清除浏览器历史记录春季安全会话未清除?
如果我清除了浏览器历史记录,则spring security的会话未清除,它将显示以下错误: org.springframework.security.web.authentication.session.SessionAuthenticationException: 已超过此主体的最大会话数1 但我需要的最大会话应该是1。这是我的配置代码Java 何时清除浏览器历史记录春季安全会话未清除?,java,spring,spring-mvc,session,spring-security,Java,Spring,Spring Mvc,Session,Spring Security,如果我清除了浏览器历史记录,则spring security的会话未清除,它将显示以下错误: org.springframework.security.web.authentication.session.SessionAuthenticationException: 已超过此主体的最大会话数1 但我需要的最大会话应该是1。这是我的配置代码 @Override protected void configure(HttpSecurity http) throws Exception { http
@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());
}
您能更清楚地描述您的问题吗?在登录我的应用程序后,我将清除我的浏览器历史记录,然后刷新我的应用程序,它将重定向到登录页面,但我已尝试再次输入它抛出的同一用户“org.springframework.security.web.authentication.session.SessionAuthenticationException:超出此主体的最大会话数1”“当然。清除浏览器cookies并不意味着此用户会话已从服务器中删除。它还在那里。所以在这种情况下,你只需要等到这个会话结束。我想你唯一能做的就是尽可能地降低会话超时值,这样你就不需要等待太长时间了。@leffchick有任何解决方案,你可以删除
maxSessionsPreventsLogin
,允许用户再次登录(使原始会话无效)。您能更清楚地描述您的问题吗?在登录我的应用程序后,我将清除我的浏览器历史记录,然后刷新我的应用程序,它将重定向到登录页面,但我已尝试再次输入它抛出的同一用户“org.springframework.security.web.authentication.session.SessionAuthenticationException:超出此主体的最大会话数1”“当然。清除浏览器cookies并不意味着此用户会话已从服务器中删除。它还在那里。所以在这种情况下,你只需要等到这个会话结束。我想你唯一能做的就是尽可能地降低会话超时值,这样你就不需要等待太长时间了。@leffchick有任何解决方案,你可以删除maxSessionsPreventsLogin
,允许用户再次登录(使原始会话无效)。