2014-06-05 1 views
3

ConcurrentSessionControlStrategy와 내 sessionRegistry 구현으로 작동하는 구성이있었습니다. 스프링 보안 3.2.4로 업그레이드하여 ConcurrentSessionControlStrategy를 ConcurrentSessionControlAuthenticationStrategy로 변경해야했습니다. 이제는 sessionRegistry가 연결되지 않은 것으로 보입니다. ConcurrentSessionControlAuthenticationStrategy.onAuthenticaton이 sessionRegistry.registerNewSession을 입력하지 않는다는 의미입니다. 뭐라구? ConcurrentSessionControlStrategy in spring security 3.2.4

내 구성 XML :

<security:http use-expressions="true" auto-config="false" 
     entry-point-ref="loginUrlAuthenticationEntryPoint"> 


     <security:intercept-url pattern="/**" 
      access="isAuthenticated()" /> 

     <security:custom-filter position="FORM_LOGIN_FILTER" 
      ref="twoFactorAuthenticationFilter" /> 



     <security:logout logout-url="/player/logout" 
      logout-success-url="/demo/player/logoutSuccess" /> 

     <security:session-management> 
      <security:concurrency-control 
       max-sessions="1" session-registry-ref="clusteredSessionRegistryImpl" 
       error-if-maximum-exceeded="false" /> 
     </security:session-management> 

    </security:http> 



    <bean 
     class="org.springframework.security.web.authentication.session.ConcurrentSessionControlAuthenticationStrategy"> 
     <constructor-arg ref="clusteredSessionRegistryImpl" /> 
     <property name="maximumSessions" value="1" /> 
    </bean> 

    <bean id="loginUrlAuthenticationEntryPoint" 
     class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint"> 
     <property name="loginFormUrl" value="/demo/player/login?login_error=true" /> 
    </bean> 

    <bean id="twoFactorAuthenticationFilter" class="com.XXX.filter.TwoFactorAuthenticationFilter"> 
     <property name="authenticationManager" ref="authenticationManager" /> 
     <property name="authenticationFailureHandler" ref="failureHandler" /> 
     <property name="authenticationSuccessHandler" ref="playerAuthenticationSuccessHandler" /> 
     <property name="postOnly" value="true" /> 
    </bean> 


    <bean id="failureHandler" 
     class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler"> 
     <property name="defaultFailureUrl" value="/login?login_error=true" /> 

    </bean> 

    <bean id="bCryptPasswordEncoder" 
     class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder" /> 

    <security:authentication-manager alias="authenticationManager"> 
     <security:authentication-provider 
      ref="authenticationProvider"> 
     </security:authentication-provider> 
    </security:authentication-manager> 

</beans> 
+0

'ConcurrentSessionControlAuthenticationStrategy'에 대한 정의는 아무 것도하지 않거나 추가하지 않으며, 네임 스페이스에 의해 구성됩니다. –

+0

잘 모르겠습니다. 내 XML은 내 세션 레지스트리 구현을 넣는다. onAuthentication을 호출하면 세션 레지스트리에 들어 가지 않는다. – lior

+1

'ConcurrentSessionControlAuthenticationStrategy' 빈 정의가 중복되었습니다. 이것은''에 의해 수행되므로 제거 할 수 있습니다. 또한 적절한 구성이 손상 될 수 있습니다 (재정의하려는 것을 무시). 요점은 모든 것이 이전의 버전에서 모든 것이 ConcurrentSessionControlStrategy 내부에서 수행되었지만 이제는 여러 클래스로 위임되는 반면, 모든 것이 분리되어 있다는 것입니다. 그러나 리던던트 빈의 등록은 아마도 기본 설정을 깨고'RegisterSessionAuthenticationStrategy'를 등록하지 않을 것입니다. –

답변

3

내가 대답 늦었 보이지만 어떤 식 으로든 ..

ConcurrentSessionControlStrategy의 기능은 정확히 지금 세 가지 전략 사이에 분할

- ConcurrentSessionControlAuthenticationStrategy, SessionFixationProtectionStrategyRegisterSessionAuthenticationStrategy .

올바른 대체품을 얻으려면 CompositeSessionAuthenticationStrategy을이 순서로 추가해야합니다.

두려워서 ConcurrentSessionControlAuthenticationStrategy은 (는) ConcurrentSessionControlStrategy 대신에 사용 중단 의견에 잘못 언급되었습니다. SessionRegistry을 유지하려면 적어도 RegisterSessionAuthenticationStrategy의 가용성이 필요합니다. 그렇지 않으면 SessionRegistry은 비어 있고 "대체"는 항상 "ok"를보고합니다.

내 생각은, 접근이 대표 대신, 여러 차례 핸들러 가진 더 유연하게 변경됩니다 (CompositeSessionAuthenticationStrategy를 사용하여, 당신은 독립 : 일을 SessionAuthenticationStrategy 년대의 수에는 제한이 없습니다).

+0

감사합니다. – IsidroGH

+0

@ 에드거, 자바 구성이 비어있는 레지스트리를 얻고 있습니다.이 자바 설정을 처리하는 방법에 대해 도움을주십시오 .... 모든 로그인 된 사용자 목록을 얻으려고합니다. –