2013-01-21 61 views
0

在我的Vaadin應用程序項目上,我想集成spring-security-SAML擴展。我從spring安全擴展頁面下載了源代碼。基於使用mvn包的手動I打包擴展,並使用mvn deploy命令將其部署到本地Maven存儲庫。一切順利。一個編譯的擴展出現在Maven倉庫中。所以我把它納入項目pom.xml文件爲這樣的依賴性:Spring SAML實現無法解析對bean的引用

<dependency> 
     <groupId>org.springframework.security.extensions</groupId> 
     <artifactId>spring-security-saml2-core</artifactId> 
     <version>1.0.0-RC1-SNAPSHOT</version> 
    </dependency> 

,我更新Maven項目後,發現彈簧安全SAML2核-1.0.0-RC1-SNAPSHOT.jar行家依賴內目錄(我正在使用Maven的eclipse IDE)。接下來我做了什麼,是appLicationContext.xml文件編輯。 applicationContext.xml文件包含在web.xml中。所以我添加下面線的applicationContext.xml文件:

<beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:security="http://www.springframework.org/schema/security" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:context="http://www.springframework.org/schema/context" 
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> 

    <context:annotation-config /> 
    <context:component-scan base-package="org.springframework.security.saml"/> 

    <security:http entry-point-ref="samlEntryPoint"> 
     <security:intercept-url pattern="/*" access="IS_AUTHENTICATED_FULLY"/> 
     <security:custom-filter before="FIRST" ref="metadataGeneratorFilter"/> 
     <security:custom-filter after="BASIC_AUTH_FILTER" ref="samlFilter"/> 
    </security:http> 

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

    <bean id="samlAuthenticationProvider" class="org.springframework.security.saml.SAMLAuthenticationProvider">  

    </bean> 

    <bean id="samlEntryPoint" class="org.springframework.security.saml.SAMLEntryPoint"> 
     <property name="defaultProfileOptions"> 
      <bean class="org.springframework.security.saml.websso.WebSSOProfileOptions"> 
       <property name="includeScoping" value="false"/> 
      </bean> 
     </property> 
    </bean> 

    <bean id="metadataGeneratorFilter" class="org.springframework.security.saml.metadata.MetadataGeneratorFilter"> 
    <constructor-arg> 
     <bean class="org.springframework.security.saml.metadata.MetadataGenerator"/> 
    </constructor-arg> 
</bean> 

上的文件這樣的變化之後,我編我的項目進入戰爭檔案,並試圖把它上傳到GlassFish服務器。但後來我得到一個錯誤:

Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': 
Cannot create inner bean '(inner bean)' of type [org.springframework.security.config.authentication.AuthenticationManagerFactoryBean] while setting bean property 'parent'; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name '(inner bean)': 
FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'samlAuthenticationProvider' while setting bean property 'providers' with key [0]; nested exception is org.springframework.beans.factory. 

我發現了幾個與這樣的問題,但不同的庫的主題。沒人能幫我解決我的問題。它看起來像org.springframework.security.saml.SAMLAuthenticationProvider無法找到或解決在戰爭檔案。但我手動檢查了它,並在WEB-INF/lib文件夾spring-security-saml2-core-1.0.0-RC1-SNAPSHOT.jar中找到它。我也檢查了jar文件,發現SAMLAuthenticationProvider.class。有沒有人可以幫助我解決我的問題。也許有人有Spring安全和saml擴展的經驗。

回答

0

我發現我使用的是不完整的securityContext.xml文件

+2

因此,您可以更新以顯示完整的securityContext.xml文件 – Scott

相關問題