0

在我的 Vaadin 应用程序项目中,我想集成 spring-security-SAML 扩展。我从 spring 安全扩展页面下载了源代码。根据手册,我使用 mvn package 打包了扩展,并使用 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>

在对文件进行此类更改后,我将我的项目编译为战争存档并尝试将其上传到 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 扩展有经验。

4

1 回答 1

-2

我发现我使用的 securityContext.xml 文件不完整

于 2013-01-25T10:57:14.060 回答