Spring Security中的最大并发用户数

我在我的项目中使用Spring Security 3.0,并且限制用户最多只有一个会话。 配置如下:

   

我想在达到最大会话时打印自定义消息(不是由spring提供的默认消息)。 请帮忙。

提前致谢!!

请将其保留在messages.properties

 ConcurrentSessionControlStrategy.exceededAllowed=This account is already using by someone. 

它将显示“此帐户已被某人使用”。 你可以给你想要的东西。

另外不要忘记配置Resourcebundle

expired-url应该是你需要的。 在弹簧安全配置中

  

还在web.xml中添加以下侦听器。

 org.springframework.security.web.session.HttpSessionEventPublisher 

这可以帮助您http://static.springsource.org/spring-security/site/docs/3.0.x/reference/session-mgmt.html

spring-security-3.2.0,message.properties:

ConcurrentSessionControlAuthenticationStrategy.exceededAllowed =超出此主体的最大会话数{0}