在我的Vaadin应用程序项目中,我想集成spring-security-SAML扩展。我从spring security扩展页面下载了源代码。基于手动I打包扩展使用mvn包并使用mvn deploy命令将其部署在本地maven存储库中。一切顺利。已编译的扩展名出现在maven存储库中。所以我将它作为依赖项包含在项目pom.xml文件中:
<dependency>
<groupId>org.springframework.security.extensions</groupId>
<artifactId>spring-security-saml2-core</artifactId>
<version>1.0.0-RC1-SNAPSHOT</version>
</dependency>
之后我更新了maven项目,并在maven依赖目录中找到了spring-security-saml2-core-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>
在对文件进行此类更改后,我将项目编译为war archive并尝试将其上载到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.
我发现了几个有这样问题的主题但不同的库。没人能帮我解决问题。看起来无法在war存档上找到或解析org.springframework.security.saml.SAMLAuthenticationProvider。但是我手动检查了它,并在WEB-INF / lib文件夹spring-security-saml2-core-1.0.0-RC1-SNAPSHOT.jar中找到了它。我还检查了jar存档,发现了SAMLAuthenticationProvider.class。有没有人可以帮我解决我的问题。也许有人有Spring安全性和saml扩展的经验。
答案 0 :(得分:-2)
我发现我使用的是不完整的securityContext.xml文件