Spring SAML Security - Multiple IDP Metadata configuration for two different ADFS server

时光总嘲笑我的痴心妄想 提交于 2019-12-11 02:38:31

问题


Is that possible to have multiple IDP Metadata configuration? How do I configure it? In my environment I have two different ADFS servers and both has its own Metadata.xml files.

In the securityContext.xml file I have following configuration for my ADFS server IDP selection:

<bean id="metadata"
class="org.springframework.security.saml.metadata.CachingMetadataManager">
<constructor-arg>
<list>
<bean class="org.opensaml.saml2.metadata.provider.HTTPMetadataProvider">
<constructor-arg>
<value type="java.lang.String">https://<adfs_server1>/FederationMetadata/2007-06/FederationMetadata.xml</value>
</constructor-arg>
<constructor-arg>
<value type="int">50000</value>
</constructor-arg>
<property name="parserPool" ref="parserPool" />
</bean>
</list>
</constructor-arg>
</bean>

is it possible to add another entry same as above for two different ADFS servers like:

<bean id="metadata"
class="org.springframework.security.saml.metadata.CachingMetadataManager">
<constructor-arg>
<list>
<bean class="org.opensaml.saml2.metadata.provider.HTTPMetadataProvider">
<constructor-arg>
<value type="java.lang.String">https://<adfs_server1>/FederationMetadata/2007-06/FederationMetadata.xml</value>
</constructor-arg>
<constructor-arg>
<value type="int">50000</value>
</constructor-arg>
<property name="parserPool" ref="parserPool" />
</bean>
</list>
</constructor-arg>
</bean>
<bean id="metadata1"
class="org.springframework.security.saml.metadata.CachingMetadataManager">
<constructor-arg>
<list>
<bean class="org.opensaml.saml2.metadata.provider.HTTPMetadataProvider">
<constructor-arg>
<value type="java.lang.String">https://<adfs_server2>/FederationMetadata/2007-06/FederationMetadata.xml</value>
</constructor-arg>
<constructor-arg>
<value type="int">50000</value>
</constructor-arg>
<property name="parserPool" ref="parserPool" />
</bean>
</list>
</constructor-arg>
</bean>

Please help.


回答1:


Yes, you can include as many IDPs as you want. But not by adding multiple CachingMetadataManager beans, you should instead include multiple MetadataProviders inside a single MetadataManager. The configuration could look like this:

<bean id="metadata" class="org.springframework.security.saml.metadata.CachingMetadataManager">
    <constructor-arg>
        <list>
            <bean class="org.opensaml.saml2.metadata.provider.HTTPMetadataProvider">
                <constructor-arg>
                    <value type="java.lang.String">https://<adfs_server1>/FederationMetadata/2007-06/FederationMetadata.xml</value>
                </constructor-arg>
                <constructor-arg>
                    <value type="int">50000</value>
                </constructor-arg>
                <property name="parserPool" ref="parserPool"/>
            </bean>
            <bean class="org.opensaml.saml2.metadata.provider.HTTPMetadataProvider">
                <constructor-arg>
                    <value type="java.lang.String">https://<adfs_server2>/FederationMetadata/2007-06/FederationMetadata.xml</value>
                </constructor-arg>
                <constructor-arg>
                    <value type="int">50000</value>
                </constructor-arg>
                <property name="parserPool" ref="parserPool"/>
            </bean>
        </list>
    </constructor-arg>
</bean>

You will need to provide a mechanism which determines which of the IDPs should be used when user wants to authenticate. You can do so either by specifying GET parameter idp with value of the entityId of the selected IDP when invoking the /saml/login endpoint, or by implementing IDP discovery.



来源:https://stackoverflow.com/questions/25993110/spring-saml-security-multiple-idp-metadata-configuration-for-two-different-adf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!