这是使用 Spring Security 4.0 RELEASE 和 Spring Security CAS。
我正在使用 Java Config 设置会话并发管理:
http
.sessionManagement()
.maximumSessions(1)
.maxSessionsPreventsLogin(false)
.expiredUrl("/tooManySessions")
.and()
.and();
HttpSessionEventublisher
在 a 中启用,WebApplicationInitializer
我可以确认它正在工作,因为我正在将它用于其他正在工作的东西:
@Override
protected void registerDispatcherServlet(ServletContext servletContext) {
super.registerDispatcherServlet(servletContext);
// to handle session creation and destruction events
servletContext.addListener(new HttpSessionEventPublisher());
}
但是在运行时,看起来代码从未被调用过。
请注意,我使用的是 Spring Security CA。这会影响会话并发管理吗?