2013-12-17 3 views
2

스프링 보안을 사용하기 위해 이전 프로그램을 업데이트하고 있습니다. 이전에는 Acegi 보안을 사용하고 SSO 헤더를 세션 쿠키로 초기 검사 한 후 자격 증명을 캐시했습니다. Spring Security 3.1.4를 사용하여 SSO 사용자 이름 헤더 (SM_USER - 아니요, 더 이상 Siteminder를 사용하지 않지만, OAM으로 전환했을 때 힘든 소프트웨어 업데이트를 피하기 위해 OAM을 요청에 SM_USER 헤더 삽입), tomcat (6.0)의 밸브 설정으로 로컬 작업 그러나 dev 환경에 배포 할 때 라이브 SSO를 사용하면 POSTS에서만 실패한 다음 동일한 URL을 사용하지만 다른 HTTP RequestMethod를 사용하는 페이지에만 오류가 발생합니다. 네트워크 트래픽을 살펴보면 이전 코드와 새로운 코드의 차이점은 새 코드가 OAM SSO 인증 요청을 한 다음 POST 인증 리디렉션이 POST 데이터를 삭제하고 RequestMethod를 GET으로 변경한다는 것입니다. 그래서 아마도 앱에 자격 정보 캐싱을 다시 추가하면 문제가 해결 될 것이라고 생각했습니다. 하지만 캐싱을 사용하려면 추가 할 수있는 구성을 찾는 데 어려움을 겪고 있습니다. 이은에스프링 보안 - SSO의 캐싱 인증서

<bean id="filterChainProxy" class="org.springframework.security.web.FilterChainProxy"> 
    <security:filter-chain-map> 
     <security:filter-chain filters="httpSessionContextIntegrationFilter, securityContextHolderAwareRequest, siteminderFilter" pattern="/fastjump/auth/**"/> 
    </security:filter-chain-map> 
</bean> 

<bean id="httpSessionContextIntegrationFilter" class="org.springframework.security.web.context.SecurityContextPersistenceFilter"> 
    <property name="securityContextRepository"> 
     <bean class="org.springframework.security.web.context.HttpSessionSecurityContextRepository"> 
      <property name="allowSessionCreation" value="false"/> 
     </bean> 
    </property> 
</bean> 

<bean id="securityContextHolderAwareRequest" class="org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter"> 
</bean> 

그리고 :

요청 인증에 따라 수행되는 보안 구성하고, 로컬로 작동합니다

<security:http use-expressions="true" auto-config="true" entry-point-ref="http403EntryPoint"> 
     <security:intercept-url pattern="/**" access="isAuthenticated()" /> 
     <security:intercept-url pattern="/fastjump/auth/admin/*" access="hasRole('ROLE_ADMINISTRATOR')" /> 
     <security:intercept-url pattern="/fastjump/auth/*" access="permitAll" /> 
     <security:custom-filter position="PRE_AUTH_FILTER" ref="siteminderFilter" /> 
    </security:http> 

    <bean id="siteminderFilter" class="org.springframework.security.web.authentication.preauth.RequestHeaderAuthenticationFilter"> 
     <property name="principalRequestHeader" value="SM_USER"/> 
     <property name="authenticationManager" ref="authenticationManager" /> 
    </bean> 

    <bean id="preauthAuthProvider" class="org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider"> 
     <property name="preAuthenticatedUserDetailsService"> 
      <bean id="userDetailsServiceWrapper" class="org.springframework.security.core.userdetails.UserDetailsByNameServiceWrapper"> 
       <property name="userDetailsService" ref="userDetailsService"/> 
      </bean> 
     </property> 
    </bean> 

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


    <!-- This is the class that handles actually looking up the user from the persistent store and associating their 
    GrantedAuthority objects. This custom implementation uses a PersonService object to do the lookup. --> 
    <bean id="userDetailsService" class="corporate.fastjump.security.DefaultUserDetailsService"> 
     <property name="personService" ref="personService"/> 
     <property name="fastJumpService" ref="fastJumpService"/> 
    </bean> 

    <bean id="http403EntryPoint" class="org.springframework.security.web.authentication.Http403ForbiddenEntryPoint"/> 

내가 보안 설정에 다음을 추가하려고했습니다 web.xml :

<!-- This filter is used to implement request level authorization. --> 
<filter> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
</filter> 

<!-- Note that we only send requests which require authentication and authorization services through the 
Spring Security filters --> 
<filter-mapping> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <url-pattern>/auth/*</url-pattern> 
</filter-mapping> 

하지만 이제/auth 컨텍스트에 기본 인증 시도가 추가됩니다. 퀘스트. 나는 pre auth와 함께 캐싱을 묶는 조각을 놓치고있다. 누구든지 어떤 제안이 있습니까?

답변

0

그래서 SSO가 문제 였지만 처음에는 생각한 방식이 아닙니다. 우리는 여러 다른 SSO 도메인 (DEV, INT, PROD)을 가지고 있으며, 문제의 페이지에 Autocompleter가 있습니다.이 페이지는 Prod 도메인의 웹 서비스로 나가기 위해 하드 코딩되어 있으며, 웹 서비스 API는 SSO 보호의 프로덕션 도메인 (모든 사용자에게 개방되어 있음)에서 프로덕션 서버를 쿼리하면 프로덕션 SSO 도메인에 쿼리가 발생하고 프로덕션 자격 증명으로 세션을 덮어 씁니다. Dev 서버로 돌아가서 Prod creds로 POST를 수행하지 못했습니다. Dev SSO에 적절한 자격 증명을 쿼리하는 과정에서 POST 데이터가 삭제되고 html 요청 유형이 GET으로 변경되었습니다. 우리의 솔루션은 autocompleter를 업데이트하여 JavaScript를 통해 실행중인 서버를 확인하고 호스트를 확인한 다음 우리가 어떤 환경에 있는지에 따라 자동 완성 백엔드 URL을 작성하는 것입니다.