title: sessionRegistry is empty when I use ConcurrentSessionControlAuthenticationStrategy instead of ConcurrentSessionControlStrategy
body: <p>inside http tag I have wrote:</p>
  
  <p></p>
  
  <p>I have following sas bean</p>
  
  <pre><code> &lt;beans:bean id="sas" class="org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy"&gt;
          &lt;beans:constructor-arg  ref="sessionRegistry" /&gt;
          &lt;beans:property name="maximumSessions" value="1" /&gt;
      &lt;/beans:bean&gt;
  </code></pre>
  
  <p>in code I get information from registry:</p>
  
  <pre><code>@Autowired
  private SessionRegistry sessionRegistry;
  ....
      sessionRegistry.getAllPrincipals()
  </code></pre>
  
  <p>Now it is working.</p>
  
  <p>But problem that class <code>org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy</code> is deprecated</p>
  
  <p>I replaced sas bean like this </p>
  
  <pre><code>&lt;beans:bean id="sas" class="org.springframework.security.web.authentication.session.ConcurrentSessionControlAuthenticationStrategy"&gt;
      &lt;beans:constructor-arg  ref="sessionRegistry" /&gt;
      &lt;beans:property name="maximumSessions" value="1" /&gt;
  &lt;/beans:bean&gt;
  </code></pre>
  
  <p>But now </p>
  
  <pre><code>sessionRegistry.getAllPrincipals()
  </code></pre>
  
  <p>returns empty list always.</p>
  
  <p>How to fix it?</p>
  
  <p>P.S.
  full configuration:</p>
  
  <p>web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app
          version="3.0"
          xmlns="http://java.sun.com/xml/ns/javaee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="
          http://java.sun.com/xml/ns/javaee
          http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd
          "&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;
              org.springframework.web.context.request.RequestContextListener
          &lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;net.bull.javamelody.SessionListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.security.web.session.HttpSessionEventPublisher&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;WEB-INF/applicationContext.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;spring.profiles.default&lt;/param-name&gt;
          &lt;param-value&gt;test&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;defaultHtmlEscape&lt;/param-name&gt;
          &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;!-- Spring MVC --&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;WEB-INF/webContext.xml&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;!-- Spring Security --&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
          &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;XSSFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;com.cj.xss.XSSFilter&lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;javamelody&lt;/filter-name&gt;
          &lt;filter-class&gt;net.bull.javamelody.MonitoringFilter&lt;/filter-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;monitoring-path&lt;/param-name&gt;
              &lt;param-value&gt;/admin/monitoring&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;javamelody&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;   
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;XSSFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;charsetFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;org.springframework.web.filter.CharacterEncodingFilter&lt;/filter-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;encoding&lt;/param-name&gt;
              &lt;param-value&gt;UTF-8&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;forceEncoding&lt;/param-name&gt;
              &lt;param-value&gt;true&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;charsetFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;error-page&gt;
          &lt;error-code&gt;404&lt;/error-code&gt;
          &lt;location&gt;/error&lt;/location&gt;
      &lt;/error-page&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>security context:</p>
  
  <pre><code>&lt;beans:beans
          xmlns="http://www.springframework.org/schema/security"
          xmlns:beans="http://www.springframework.org/schema/beans"
          xmlns:sec="http://www.springframework.org/schema/security"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
          http://www.springframework.org/schema/security
          http://www.springframework.org/schema/security/spring-security.xsd"&gt;
  
      &lt;http auto-config="true" pattern="/admin/**" authentication-manager-ref="adminAuthenticationManager"&gt;
          &lt;access-denied-handler error-page="/403" /&gt;
          &lt;custom-filter ref="concurrencyFilter" after="SECURITY_CONTEXT_FILTER"/&gt;
          &lt;form-login login-page="/loginAdmin" login-processing-url="/admin/j_spring_security_check_admin"
                      default-target-url="/admin"
                      authentication-failure-url="/loginAdminFailed"
                      authentication-success-handler-ref="authAdminSuccessHandler"/&gt;
  
          &lt;intercept-url pattern="/admin/j_spring_security_check_admin" access="ROLE_ANONYMOUS"/&gt;
          &lt;intercept-url pattern="/admin/accounts/**" access="ROLE_SUPERADMIN"/&gt;
          &lt;intercept-url pattern="/admin/users/**" access="ROLE_SUPERADMIN"/&gt;
          &lt;intercept-url pattern="/admin/terminals/**" access="ROLE_SUPERADMIN, ROLE_TERMINAL_MODERATOR, ROLE_MODERATOR"/&gt;
          &lt;intercept-url pattern="/admin/money/**" access="ROLE_FINANSIER, ROLE_SUPERADMIN"/&gt;
          &lt;intercept-url pattern="/admin/moderation/**" access="ROLE_SUPERADMIN,ROLE_MODERATOR"/&gt;
          &lt;intercept-url pattern="/admin/moderation/pictures"
                         access="ROLE_SUPERADMIN,ROLE_MODERATOR, ROLE_IMAGE_MODERATOR"/&gt;
          &lt;intercept-url pattern="/admin/statistic/**" access="ROLE_SUPERADMIN"/&gt;
          &lt;intercept-url pattern="/admin/rules/**" access="ROLE_SUPERADMIN"/&gt;
          &lt;intercept-url pattern="/admin/terminals/addImageToTerminal"
                         access="ROLE_SUPERADMIN, ROLE_TERMINAL_MODERATOR, ROLE_MODERATOR"/&gt;
          &lt;intercept-url pattern="/admin/terminals/deleteTerminalImage"
                         access="ROLE_SUPERADMIN, ROLE_TERMINAL_MODERATOR, ROLE_MODERATOR"/&gt;
          &lt;intercept-url pattern="/admin/systemGroupsModeration" access="ROLE_SUPERADMIN"/&gt;
          &lt;intercept-url pattern="/admin/adminUsers" access="ROLE_SUPERADMIN"/&gt;
          &lt;intercept-url pattern="/admin/contentModeration/**" access="ROLE_SUPERADMIN, ROLE_MODERATOR, ROLE_IMAGE_MODERATOR"/&gt;
          &lt;intercept-url pattern="/admin/campaignModeration/**" access="ROLE_SUPERADMIN, ROLE_MODERATOR"/&gt;
          &lt;intercept-url pattern="/admin/monitoring" access="ROLE_SUPERADMIN"/&gt;
  
          &lt;logout logout-url="/logout" logout-success-url="/loginAdmin"/&gt;
          &lt;port-mappings&gt;
              &lt;port-mapping http="${http.port}" https="${https.port}"/&gt;
          &lt;/port-mappings&gt;
          &lt;session-management session-authentication-strategy-ref="sas" invalid-session-url="/invalid-session" /&gt;
      &lt;/http&gt;
      &lt;http auto-config="true" authentication-manager-ref="userAuthenticationManager"&gt;
          &lt;form-login login-page="/"
                      default-target-url="/member/personalAccount"
                      authentication-failure-url="/loginfailed" authentication-success-handler-ref="authSuccessHandler"/&gt;
  
          &lt;!-- &lt;intercept-url pattern="/common/*" filters="none" /&gt; --&gt;
          &lt;intercept-url pattern="/member/createCompany/addParams" access="ROLE_ANONYMOUS, ROLE_USER"/&gt;
          &lt;intercept-url pattern="/member/**" access="ROLE_USER"/&gt;
          &lt;intercept-url pattern="/owner/*" access="ROLE_OWNER"/&gt;
          &lt;intercept-url pattern="/member/getImage/*"
                         access="ROLE_ANONYMOUS, ROLE_OWNER,ROLE_USER, ROLE_SUPERADMIN, ROLE_TERMINAL_MODERATOR, ROLE_IMAGE_MODERATOR, ROLE_CAMPAIGN_MODERATOR, ROLE_FINANSIER, ROLE_MODERATOR"/&gt;
  
          &lt;logout logout-url="/logout" logout-success-url="/"/&gt;
          &lt;port-mappings&gt;
              &lt;port-mapping http="${http.port}" https="${https.port}"/&gt;
          &lt;/port-mappings&gt;
      &lt;/http&gt;
  
      &lt;beans:bean id="userSecurityService" class="com.terminal.service.impl.UserSecurityService"/&gt;
      &lt;beans:bean id="authSuccessHandler" class="com.terminal.filter.RoleAuthSuccessHandler"/&gt;
  
      &lt;beans:bean id="authAdminSuccessHandler" class="com.terminal.filter.admin.RoleAuthAdminHandler"/&gt;
      &lt;beans:bean id="adminSecurityService" class="com.terminal.service.admin.impl.TerminalAdminSecurityServiceImpl"/&gt;
  
      &lt;beans:bean id="webexpressionHandler"
                  class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/&gt;
  
      &lt;authentication-manager id="adminAuthenticationManager"&gt;
          &lt;authentication-provider user-service-ref="adminSecurityService"&gt;
              &lt;password-encoder ref="encoder"/&gt;
          &lt;/authentication-provider&gt;
      &lt;/authentication-manager&gt;
  
      &lt;authentication-manager id="userAuthenticationManager"&gt;
          &lt;authentication-provider user-service-ref="userSecurityService"&gt;
              &lt;password-encoder ref="encoder"/&gt;
          &lt;/authentication-provider&gt;
      &lt;/authentication-manager&gt;
  
      &lt;authentication-manager id="internalUserAuthenticationManager"&gt;
          &lt;authentication-provider user-service-ref="userSecurityService"&gt;
              &lt;password-encoder ref="noopEncoder"/&gt;
          &lt;/authentication-provider&gt;
      &lt;/authentication-manager&gt;
  
      &lt;beans:bean id="encoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"&gt;
          &lt;beans:constructor-arg index="0" value="10"/&gt;
      &lt;/beans:bean&gt;
      &lt;beans:bean id="noopEncoder" class="org.springframework.security.crypto.password.NoOpPasswordEncoder"/&gt;
  
      &lt;beans:bean id="sessionRegistry" class="org.springframework.security.core.session.SessionRegistryImpl"/&gt;
  
      &lt;beans:bean id="sas" class="org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy"&gt;
          &lt;beans:constructor-arg  ref="sessionRegistry" /&gt;
          &lt;beans:property name="maximumSessions" value="1" /&gt;
      &lt;/beans:bean&gt;
  
      &lt;beans:bean id="concurrencyFilter"
                  class="org.springframework.security.web.session.ConcurrentSessionFilter"&gt;
          &lt;beans:property name="sessionRegistry" ref="sessionRegistry" /&gt;
          &lt;beans:property name="expiredUrl" value="/" /&gt;
      &lt;/beans:bean&gt;
  
  &lt;/beans:beans&gt;
  </code></pre>
  
  <p>applicationContext.xml:</p>
  
  <pre><code>&lt;beans
          xmlns="http://www.springframework.org/schema/beans"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:context="http://www.springframework.org/schema/context"
          xsi:schemaLocation="
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context.xsd
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
          "&gt;
  
      &lt;import resource="classpath:META-INF/dataContext.xml"/&gt;
      &lt;import resource="classpath:META-INF/restTemplateContext.xml" /&gt;
      &lt;import resource="classpath:META-INF/securityContext.xml"/&gt;
  
      &lt;context:component-scan base-package="com.terminal" &gt;
          &lt;context:include-filter type="annotation" expression="org.aspectj.lang.annotation.Aspect"/&gt;
          &lt;context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/&gt;
      &lt;/context:component-scan&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>dataContext.xml</p>
  
  <pre><code>&lt;beans
          xmlns="http://www.springframework.org/schema/beans"
          xmlns:p="http://www.springframework.org/schema/p"
          xmlns:context="http://www.springframework.org/schema/context"
          xmlns:tx="http://www.springframework.org/schema/tx"
          xmlns:jdbc="http://www.springframework.org/schema/jdbc"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:task="http://www.springframework.org/schema/task"
          xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context.xsd
          http://www.springframework.org/schema/tx
          http://www.springframework.org/schema/tx/spring-tx.xsd
          http://www.springframework.org/schema/jdbc
          http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
  
           http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd"&gt;
  
      &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
  
      &lt;context:component-scan base-package="com.terminal.domain, com.terminal.dao, com.terminal.utils"/&gt;
  
      &lt;bean id="transactionManager"
            class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="messageSource"
            class="org.springframework.context.support.ResourceBundleMessageSource"&gt;
          &lt;property name="basenames"&gt;
              &lt;list&gt;
                  &lt;value&gt;mymessages&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;task:scheduler id="jobScheduler" pool-size="10"/&gt;
  
      &lt;beans profile="test"&gt;
  
          &lt;bean id="wrappedDataSource" class="net.bull.javamelody.SpringDataSourceFactoryBean"&gt;
              &lt;property name="targetName" value="dataSource" /&gt;
          &lt;/bean&gt;
  
          &lt;bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource"&gt;
              &lt;property name="driverClassName" value="org.h2.Driver" /&gt;
              &lt;property name="url" value="jdbc:h2:~/test;MODE=PostgreSQL" /&gt;
              &lt;property name="username" value="sa" /&gt;
              &lt;property name="password" value="" /&gt;
          &lt;/bean&gt;
  
          &lt;bean id="sessionFactory"
                class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
              &lt;property name="dataSource" ref="wrappedDataSource"/&gt;
              &lt;property name="configLocation"&gt;
                  &lt;value&gt;classpath:hibernate-test.cfg.xml&lt;/value&gt;
              &lt;/property&gt;
              &lt;property name="hibernateProperties"&gt;
                  &lt;props&gt;
                      &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                      &lt;prop key="hibernate.connection.charSet"&gt;UTF-8&lt;/prop&gt;
                      &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                      &lt;prop key="hibernate.format_sql"&gt;true&lt;/prop&gt;
                      &lt;prop key="hbm2ddl.auto"&gt;create-drop&lt;/prop&gt;
                  &lt;/props&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
  
          &lt;context:property-placeholder location="classpath:jdbc.properties"/&gt;
  
      &lt;/beans&gt;
      &lt;beans profile="dev"&gt;
  
          &lt;bean id="wrappedDataSource" class="net.bull.javamelody.SpringDataSourceFactoryBean"&gt;
              &lt;property name="targetName" value="dataSource" /&gt;
          &lt;/bean&gt;
  
          &lt;bean id="sessionFactory"
                class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
              &lt;property name="dataSource" ref="wrappedDataSource"/&gt;
              &lt;property name="configLocation"&gt;
                  &lt;value&gt;classpath:hibernate.cfg.xml&lt;/value&gt;
              &lt;/property&gt;
              &lt;property name="hibernateProperties"&gt;
                  &lt;props&gt;
                      &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                      &lt;prop key="hibernate.dialect"&gt;${jdbc.dialect}&lt;/prop&gt;
                      &lt;prop key="hibernate.connection.charSet"&gt;UTF-8&lt;/prop&gt;
                      &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                      &lt;prop key="hibernate.format_sql"&gt;true&lt;/prop&gt;
                      &lt;prop key="hbm2ddl.auto"&gt;validate&lt;/prop&gt;
                  &lt;/props&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
  
          &lt;context:property-placeholder location="classpath:jdbc-local.properties"/&gt;
          &lt;bean id="dataSource"
                class="org.springframework.jdbc.datasource.DriverManagerDataSource"
                p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.databaseurl}"
                p:username="${jdbc.username}" p:password="${jdbc.password}"/&gt;
      &lt;/beans&gt;
      &lt;beans profile="prod"&gt;
  
          &lt;bean id="wrappedDataSource" class="net.bull.javamelody.SpringDataSourceFactoryBean"&gt;
              &lt;property name="targetName" value="dataSource" /&gt;
          &lt;/bean&gt;
  
          &lt;bean id="sessionFactory"
                class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
              &lt;property name="dataSource" ref="wrappedDataSource"/&gt;
              &lt;property name="configLocation"&gt;
                  &lt;value&gt;classpath:hibernate.cfg.xml&lt;/value&gt;
              &lt;/property&gt;
              &lt;property name="hibernateProperties"&gt;
                  &lt;props&gt;
                      &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                      &lt;prop key="hibernate.dialect"&gt;${jdbc.dialect}&lt;/prop&gt;
                      &lt;prop key="hibernate.connection.charSet"&gt;UTF-8&lt;/prop&gt;
                      &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                      &lt;prop key="hibernate.format_sql"&gt;true&lt;/prop&gt;
                      &lt;prop key="hbm2ddl.auto"&gt;validate&lt;/prop&gt;
                  &lt;/props&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
  
          &lt;context:property-placeholder location="classpath:jdbc.properties"/&gt;
          &lt;bean id="dataSource"
                class="org.springframework.jdbc.datasource.DriverManagerDataSource"
                p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.databaseurl}"
                p:username="${jdbc.username}" p:password="${jdbc.password}"/&gt;
      &lt;/beans&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>restTemplateContext.xml</p>
  
  <pre><code>&lt;beans
          xmlns="http://www.springframework.org/schema/beans"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
          "&gt;
  
      &lt;bean id="restTemplate" class="org.springframework.web.client.RestTemplate"&gt;
          &lt;property name="messageConverters"&gt;
              &lt;list&gt;
                  &lt;bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/&gt;
                  &lt;bean class="org.springframework.http.converter.FormHttpMessageConverter"/&gt;
                  &lt;bean class="com.terminal.converter.MatrixVariablesMessageConverter"/&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>securityContext.xml</p>
  
  <pre><code>&lt;beans:beans
          xmlns="http://www.springframework.org/schema/security"
          xmlns:beans="http://www.springframework.org/schema/beans"
          xmlns:sec="http://www.springframework.org/schema/security"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
          http://www.springframework.org/schema/security
          http://www.springframework.org/schema/security/spring-security.xsd"&gt;
  
      &lt;http auto-config="true" pattern="/admin/**" authentication-manager-ref="adminAuthenticationManager"&gt;
          &lt;access-denied-handler error-page="/403" /&gt;
          &lt;custom-filter ref="concurrencyFilter" after="SECURITY_CONTEXT_FILTER"/&gt;
          &lt;form-login login-page="/loginAdmin" login-processing-url="/admin/j_spring_security_check_admin"
                      default-target-url="/admin"
                      authentication-failure-url="/loginAdminFailed"
                      authentication-success-handler-ref="authAdminSuccessHandler"/&gt;
  
          &lt;intercept-url pattern="/admin/j_spring_security_check_admin" access="ROLE_ANONYMOUS"/&gt;
          &lt;intercept-url pattern="/admin/accounts/**" access="ROLE_SUPERADMIN"/&gt;
          &lt;intercept-url pattern="/admin/users/**" access="ROLE_SUPERADMIN"/&gt;
          &lt;intercept-url pattern="/admin/terminals/**" access="ROLE_SUPERADMIN, ROLE_TERMINAL_MODERATOR, ROLE_MODERATOR"/&gt;
          &lt;intercept-url pattern="/admin/money/**" access="ROLE_FINANSIER, ROLE_SUPERADMIN"/&gt;
          &lt;intercept-url pattern="/admin/moderation/**" access="ROLE_SUPERADMIN,ROLE_MODERATOR"/&gt;
          &lt;intercept-url pattern="/admin/moderation/pictures"
                         access="ROLE_SUPERADMIN,ROLE_MODERATOR, ROLE_IMAGE_MODERATOR"/&gt;
          &lt;intercept-url pattern="/admin/statistic/**" access="ROLE_SUPERADMIN"/&gt;
          &lt;intercept-url pattern="/admin/rules/**" access="ROLE_SUPERADMIN"/&gt;
          &lt;intercept-url pattern="/admin/terminals/addImageToTerminal"
                         access="ROLE_SUPERADMIN, ROLE_TERMINAL_MODERATOR, ROLE_MODERATOR"/&gt;
          &lt;intercept-url pattern="/admin/terminals/deleteTerminalImage"
                         access="ROLE_SUPERADMIN, ROLE_TERMINAL_MODERATOR, ROLE_MODERATOR"/&gt;
          &lt;intercept-url pattern="/admin/systemGroupsModeration" access="ROLE_SUPERADMIN"/&gt;
          &lt;intercept-url pattern="/admin/adminUsers" access="ROLE_SUPERADMIN"/&gt;
          &lt;intercept-url pattern="/admin/contentModeration/**" access="ROLE_SUPERADMIN, ROLE_MODERATOR, ROLE_IMAGE_MODERATOR"/&gt;
          &lt;intercept-url pattern="/admin/campaignModeration/**" access="ROLE_SUPERADMIN, ROLE_MODERATOR"/&gt;
          &lt;intercept-url pattern="/admin/monitoring" access="ROLE_SUPERADMIN"/&gt;
  
          &lt;logout logout-url="/logout" logout-success-url="/loginAdmin"/&gt;
          &lt;port-mappings&gt;
              &lt;port-mapping http="${http.port}" https="${https.port}"/&gt;
          &lt;/port-mappings&gt;
          &lt;session-management session-authentication-strategy-ref="sas" invalid-session-url="/invalid-session" /&gt;
      &lt;/http&gt;
      &lt;http auto-config="true" authentication-manager-ref="userAuthenticationManager"&gt;
          &lt;form-login login-page="/"
                      default-target-url="/member/personalAccount"
                      authentication-failure-url="/loginfailed" authentication-success-handler-ref="authSuccessHandler"/&gt;
  
          &lt;!-- &lt;intercept-url pattern="/common/*" filters="none" /&gt; --&gt;
          &lt;intercept-url pattern="/member/createCompany/addParams" access="ROLE_ANONYMOUS, ROLE_USER"/&gt;
          &lt;intercept-url pattern="/member/**" access="ROLE_USER"/&gt;
          &lt;intercept-url pattern="/owner/*" access="ROLE_OWNER"/&gt;
          &lt;intercept-url pattern="/member/getImage/*"
                         access="ROLE_ANONYMOUS, ROLE_OWNER,ROLE_USER, ROLE_SUPERADMIN, ROLE_TERMINAL_MODERATOR, ROLE_IMAGE_MODERATOR, ROLE_CAMPAIGN_MODERATOR, ROLE_FINANSIER, ROLE_MODERATOR"/&gt;
  
          &lt;logout logout-url="/logout" logout-success-url="/"/&gt;
          &lt;port-mappings&gt;
              &lt;port-mapping http="${http.port}" https="${https.port}"/&gt;
          &lt;/port-mappings&gt;
      &lt;/http&gt;
  
      &lt;beans:bean id="userSecurityService" class="com.terminal.service.impl.UserSecurityService"/&gt;
      &lt;beans:bean id="authSuccessHandler" class="com.terminal.filter.RoleAuthSuccessHandler"/&gt;
  
      &lt;beans:bean id="authAdminSuccessHandler" class="com.terminal.filter.admin.RoleAuthAdminHandler"/&gt;
      &lt;beans:bean id="adminSecurityService" class="com.terminal.service.admin.impl.TerminalAdminSecurityServiceImpl"/&gt;
  
      &lt;beans:bean id="webexpressionHandler"
                  class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/&gt;
  
      &lt;authentication-manager id="adminAuthenticationManager"&gt;
          &lt;authentication-provider user-service-ref="adminSecurityService"&gt;
              &lt;password-encoder ref="encoder"/&gt;
          &lt;/authentication-provider&gt;
      &lt;/authentication-manager&gt;
  
      &lt;authentication-manager id="userAuthenticationManager"&gt;
          &lt;authentication-provider user-service-ref="userSecurityService"&gt;
              &lt;password-encoder ref="encoder"/&gt;
          &lt;/authentication-provider&gt;
      &lt;/authentication-manager&gt;
  
      &lt;authentication-manager id="internalUserAuthenticationManager"&gt;
          &lt;authentication-provider user-service-ref="userSecurityService"&gt;
              &lt;password-encoder ref="noopEncoder"/&gt;
          &lt;/authentication-provider&gt;
      &lt;/authentication-manager&gt;
  
      &lt;beans:bean id="encoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"&gt;
          &lt;beans:constructor-arg index="0" value="10"/&gt;
      &lt;/beans:bean&gt;
      &lt;beans:bean id="noopEncoder" class="org.springframework.security.crypto.password.NoOpPasswordEncoder"/&gt;
  
      &lt;beans:bean id="sessionRegistry" class="org.springframework.security.core.session.SessionRegistryImpl"/&gt;
  
      &lt;beans:bean id="sas" class="org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy"&gt;
          &lt;beans:constructor-arg  ref="sessionRegistry" /&gt;
          &lt;beans:property name="maximumSessions" value="1" /&gt;
      &lt;/beans:bean&gt;
  
      &lt;beans:bean id="concurrencyFilter"
                  class="org.springframework.security.web.session.ConcurrentSessionFilter"&gt;
          &lt;beans:property name="sessionRegistry" ref="sessionRegistry" /&gt;
          &lt;beans:property name="expiredUrl" value="/" /&gt;
      &lt;/beans:bean&gt;
  
  &lt;/beans:beans&gt;
  </code></pre>