【问题标题】:SAML service provider spring securitySAML 服务提供者 Spring Security
【发布时间】:2014-04-24 16:57:19
【问题描述】:

当使用预配置的服务提供者元数据时,在 Spring Security 中,扩展元数据委托是否应该有 2 个 bean 定义?一个用于 IDP 元数据,一个用于 SP 元数据?

<bean class="org.springframework.security.saml.metadata.ExtendedMetadataDelegate">
    <constructor-arg>
        <bean class="org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider">
            <constructor-arg>
                <value type="java.io.File">classpath:security/localhost_sp.xml</value>
            </constructor-arg>
            <property name="parserPool" ref="parserPool"/>
        </bean>
    </constructor-arg>
    <constructor-arg>
        <bean class="org.springframework.security.saml.metadata.ExtendedMetadata">
           <property name="local" value="true"/>
           <property name="alias" value="default"/>
           <property name="securityProfile" value="metaiop"/>
           <property name="sslSecurityProfile" value="pkix"/>
           <property name="signingKey" value="apollo"/>
           <property name="encryptionKey" value="apollo"/>
           <property name="requireArtifactResolveSigned" value="false"/>
           <property name="requireLogoutRequestSigned" value="false"/>
           <property name="requireLogoutResponseSigned" value="false"/>
           <property name="idpDiscoveryEnabled" value="true"/>
           <property name="idpDiscoveryURL"
              value="https://www.server.com:8080/context/saml/discovery/alias/default"/>
           <property name="idpDiscoveryResponseURL"
              value="https://www.server.com:8080/context/saml/login/alias/default?disco=true"/>
        </bean>
    </constructor-arg>
</bean>




<bean class="org.springframework.security.saml.metadata.ExtendedMetadataDelegate">
    <constructor-arg>
        <bean class="org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider">
            <constructor-arg>
                <value type="java.io.File">classpath:security/idp.xml</value>
            </constructor-arg>
            <property name="parserPool" ref="parserPool"/>
        </bean>
    </constructor-arg>
    <constructor-arg>
        <bean class="org.springframework.security.saml.metadata.ExtendedMetadata"/>
    </constructor-arg>
</bean>

【问题讨论】:

    标签: java spring-security spring-saml


    【解决方案1】:

    找到了我的问题的答案....把它放在这里以防其他人也在寻找同样的问题。

         <bean id="metadata" class="org.springframework.security.saml.metadata.CachingMetadataManager">
            <constructor-arg>
                <list>
    
                <bean class="org.springframework.security.saml.metadata.ExtendedMetadataDelegate">
                    <constructor-arg>
                        <bean class="org.opensaml.saml2.metadata.provider.HTTPMetadataProvider">
                            <constructor-arg>
    
                            <value type="java.lang.String">http://idp.ssocircle.com/idp-meta.xml</value>
    
                            </constructor-arg>
                            <constructor-arg>
                                <!-- Timeout for metadata loading in ms -->
                                <value type="int">5000</value>
                            </constructor-arg>
                            <property name="parserPool" ref="parserPool"/>
                        </bean>
                    </constructor-arg>
                    <constructor-arg>
                        <bean class="org.springframework.security.saml.metadata.ExtendedMetadata"/>
                    </constructor-arg>
                    <property name="metadataTrustCheck"  value="false"/>
                </bean>
    
                <bean class="org.springframework.security.saml.metadata.ExtendedMetadataDelegate">
    
                <constructor-arg>
                        <bean class="org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider">
                            <constructor-arg>
                                <value type="java.io.File">file:///C:/SP_Metadata.xml</value>
                            </constructor-arg>
                            <property name="parserPool" ref="parserPool"/>
                        </bean>
                    </constructor-arg>
                    <constructor-arg>
                               <bean class="org.springframework.security.saml.metadata.ExtendedMetadata">
                           <property name="local" value="true"/>
                           <property name="alias" value="defaultAlias"/>
                           <property name="securityProfile" value="metaiop"/>
                           <property name="sslSecurityProfile" value="pkix"/>
                           <property name="signingKey" value="apollo"/>
                           <property name="encryptionKey" value="apollo"/>
                           <property name="requireArtifactResolveSigned" value="true"/>
                           <property name="requireLogoutRequestSigned" value="true"/>
                           <property name="requireLogoutResponseSigned" value="false"/>
                           <property name="idpDiscoveryEnabled" value="true"/>
                           <property name="idpDiscoveryURL" value="https://localhost/mywebapp-SNAPSHOT/saml/discovery/alias/defaultAlias"/>
                           <property name="idpDiscoveryResponseURL" value="https://localhost/mywebapp-SNAPSHOT/saml/login/alias/defaultAlias?disco=true"/>
                        </bean>
                    </constructor-arg>
                </bean>
                </list>
            </constructor-arg>
    <!-- my SP_metadata had this as the entity id -->
            <property name="hostedSPName" value="urn:test:myapp:auth"/> 
    <!-- my idp metadata points to the sso circle idp -->
              <property name="defaultIDP" value="http://idp.ssocircle.com"/> 
        </bean>
    

    【讨论】:

    • 你从哪里得到 parserPool bean?
    • @Charlires @Bean public ParserPool parserPool() throws Exception { StaticBasicParserPool pool = new StaticBasicParserPool(); pool.initialize(); return pool; }
    • @egaga 你能分享一下 SP_Metadata.xml 文件吗
    猜你喜欢
    • 2019-07-23
    • 2016-05-08
    • 2016-04-04
    • 2020-10-26
    • 1970-01-01
    • 2014-10-27
    • 2012-08-07
    • 2014-11-13
    • 1970-01-01
    相关资源
    最近更新 更多