Well, it depends on which version of spring you are using.
In spring Security 3.0, it is enough to have the following configuration:
<security:session-management> <security:concurrency-control max-sessions="1"/> </security:session-management>
Because internally, the ConcurrentSessionControlStrategy class is used, which calls registerNewSession in sessionRegistry .
In spring, Security 3.2 is different and you need to use a more detailed configuration. There is an example in Spring. Security reference document. The most important part that has a sessionRegistry populated with data is as follows:
<beans:bean id="sas" class="org.springframework.security.web.authentication.session.CompositeSessionAuthenticationStrategy"> <beans:constructor-arg> <beans:list> <beans:bean class="org.springframework.security.web.authentication.session.ConcurrentSessionControlAuthenticationStrategy"> <beans:constructor-arg ref="sessionRegistry"/> <beans:property name="maximumSessions" value="1" /> </beans:bean> <beans:bean class="org.springframework.security.web.authentication.session.RegisterSessionAuthenticationStrategy"> <beans:constructor-arg ref="sessionRegistry"/> </beans:bean> </beans:list> </beans:constructor-arg> </beans:bean> <beans:bean id="sessionRegistry" class="org.springframework.security.core.session.SessionRegistryImpl" />
Registering a new session in sessionRegistry is performed in the RegisterSessionAuthenticationStrategy class.
Hope this helps you.
Paweł grześ
source share