Other benefits of concurrent session control
Another benefit of concurrent session control is that SessionRegistry
exists to track active (and, optionally, expired) sessions. This means that we can get runtime information about what user activity exists in our system (for authenticated users, at least) by performing the following steps:
- You can even do this if you don’t want to enable concurrent session control. Simply set
maximumSessions
to-1
, and session tracking will remain enabled, even though no maximum will be enforced. Instead, we will use the explicit bean configuration provided in theSessionConfig.java
file of this chapter, as follows://src/main/java/com/packtpub/springsecurity/configuration/SessionConfig.java @Bean public SessionRegistry sessionRegistry(){ return new SessionRegistryImpl(); }
- We have already added the import of the
SessionConfig.java
file to theSecurityConfig.java
file. So, all that we need to do is reference the...