SAML远程发现服务:缺少"返回"参数

时间:2015-11-26 16:41:27

标签: spring spring-security saml-2.0 spring-saml

我使用的是Spring Security SAML 1.0.1。我set up the IDP metadata so it reaches a Discovery serviceTask<T>定义。placed in the new line。此参数包含网址idpDiscoveryURL

已到达远程发现,但它抱怨该请求不包含&#34; return&#34;参数。实际上,这是Spring SAML生成的请求:

http://wayf-shib.ueb.eu/fede-renater/WAYF

生成的参数是:

  • http://wayf-shib.ueb.eu/fede-renater/WAYF?entityID=http%3A%2F%2Facem.u-bretagneloire.fr%3A80%2FACEM%2Fsaml%2Fmetadata&returnIDParam=idp 具有正确的值;
  • entityID,其值为&#34; idp&#34;这是由Spring SAML自动设置的。

问题:如何配置Spring Security SAML以便它在请求中生成returnIDParam参数?

如果这有帮助,这是我目前的配置:

return

1 个答案:

答案 0 :(得分:1)

解决了!必须使用编码形式的return查询字符串传递idpDiscoveryURL参数。

虽然这听起来很明显,但是当我们阅读文档时(根本没有关于此参数的内容),这真的不是。

由于Spring SAML的大多数配置都是使用<property name="..." value="..." />标记完成的,因此我需要两周的时间来正确配置这些内容。

我的bean metadata的配置现在看起来像这样:

<!-- IDP Metadata configuration - paths to metadata of IDPs in circle of 
    trust is here -->
<b:bean id="metadata"
    class="org.springframework.security.saml.metadata.CachingMetadataManager">
    <b:constructor-arg>
        <b:list>
            <b:bean
                class="org.springframework.security.saml.metadata.ExtendedMetadataDelegate">
                <b:constructor-arg>
                    <b:bean
                        class="org.opensaml.saml2.metadata.provider.HTTPMetadataProvider">
                        <!-- URL containing the metadata -->
                        <b:constructor-arg>
                            <b:value type="java.lang.String">https://federation.renater.fr/test/renater-test-metadata.xml</b:value>
                        </b:constructor-arg>
                        <!-- Timeout for metadata loading in ms -->
                        <b:constructor-arg>
                            <b:value type="int">15000</b:value>
                        </b:constructor-arg>
                        <b:property name="parserPool" ref="parserPool" />
                    </b:bean>
                </b:constructor-arg>
                <b:constructor-arg>
                    <!-- Default extended metadata for entities not specified in the map -->
                    <b:bean
                        class="org.springframework.security.saml.metadata.ExtendedMetadata">
                        <b:property name="idpDiscoveryEnabled" value="true"/>
                        <b:property name="idpDiscoveryURL" value="https://wayf-test.ueb.eu/fede-renater-ueb-test/WAYF?return=http%3A%2F%2Facem.u-bretagneloire.fr%2FACEM%2Fsaml%2Flogin"/>
                        <!-- 
                        <b:property name="idpDiscoveryURL" value="https://discovery.renater.fr/test?entityId=http%3A%2F%2Facem.u-bretagneloire.fr%3A80%2FACEM%2Fsaml%2Fmetadata&amp;return=http%3A%2F%2Facem.u-bretagneloire.fr%2FACEM%2Fsaml%2Flogin"/>
                        -->
                        <b:property name="idpDiscoveryResponseURL" value="http://acem.u-bretagneloire.fr/ACEM/saml/login/alias/defaultAlias?disco=true"/>
                    </b:bean>
                </b:constructor-arg>
                <b:constructor-arg>
                    <!-- Extended metadata for specific IDPs -->
                    <b:map>
                        <b:entry key="http://idp.ssocircle.com">
                            <b:bean
                                class="org.springframework.security.saml.metadata.ExtendedMetadata" />
                        </b:entry>
                    </b:map>
                </b:constructor-arg>
            </b:bean>
        </b:list>
    </b:constructor-arg>
    <!-- OPTIONAL used when one of the metadata files contains information 
        about this service provider -->
    <b:property name="hostedSPName" value="http://acem.u-bretagneloire.fr:80/ACEM/saml/metadata"/>
    <!-- OPTIONAL property: can tell the system which IDP should be used for 
        authenticating user by default. -->
    <b:property name="defaultIDP" value="https://ident-shib-test.univ-rennes1.fr/idp/shibboleth"/>
</b:bean>