simplesamlphp / simplesamlphp/simplesamlphp

Option to disable DiscoveryResponse (issue with external Discovery Service)

未关闭
#2,573 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
PHP
星标
1.1k
派生
704
平均合并
1 天 15 小时
30 天内合并 PR
4

描述

Is your feature request related to a problem? Please describe.

Yes.
In short:
SwitchWAYF discovery service trigger issues with this namespace added in SimpleSAMLPhP metadatas as of version 2.4.x:

xmlns:idpdisc="urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol"
<md:Extensions> <idpdisc:DiscoveryResponse xmlns:idpdisc="urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol" Binding="urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol" Location="https://..../simplesaml/module.php/saml/sp/discoResponse/<aut-source-sp>" index="0"/> </md:Extensions>

Details:

The new branch 2.4 of SSP introduced a mandatory endpoint for DiscoveryResponse, this EVEN if the discoURL config in authsources point to an external discovery service.

At Belnet (Belgian NREN), we are making use of SimpleSAMLPhP as SP for some of our services, like FileSender.
Our authsources.php config is set to redirect to an external Discovery Service which is built with the SwitchWAYF:
'discoURL' =>

The discovery service (based on SwitchWAYF) is then providing a list of IdP's members in the Belnet's R&E federation.
We publish our SP (Filesender) metadatas in the Belnet's R&E federation global metadata file using the Metadata SAML URL provided on SP admin module.

The version of SwitchWAYF that we use is incompatible with the sections in the SP metadata of the namespace related to idp-discovery-protocol introduced since version 2.4 .

Describe the solution you'd like

Obtain the construction of the SP metadata without including the namespace related to idp-discovery-protocol
Here are two approaches:

  • Disable DiscoveryResponse when using an external discovery service (i.e. when discoURL is configured in authsources.php)
    (referred as Method A hereunder)
    OR
  • Disable DiscoveryResponse explicitly through metadata option
    (referred as Method B hereunder)
Describe alternatives you've considered

I tested both approaches (method A & method B) with a test instance of our FileSender service, running version 2.4.2 of SimpleSAMLPhP
This was done by modifying the SP metadata construction so that it no longer included any references of the namespace idp-discovery-protocol.

To achieve this, I successfully tested both methods by modifying the file modules/saml/src/Auth/Source/SP.php

  • Method A: Disable DiscoveryResponse when using an external discovery service (i.e. when discoURL is configured in authsources.php)
/**
     * Retrieve the metadata array of this SP, as a remote IdP would see it.
     *
     * @return array The metadata array for its use by a remote IdP.
     */
    public function getHostedMetadata(): array
    {
        $entityid = $this->getEntityId();
        $metadata = [
            'entityid' => $entityid,
            'metadata-set' => 'saml20-sp-remote',
            'SingleLogoutService' => $this->getSLOEndpoints(),
            'AssertionConsumerService' => $this->getACSEndpoints(),
        ];

        // METHOD A: Disable DiscoveryResponse when using an external discovery service
        // (i.e. when discoURL is configured in authsources.php)
        if (empty($this->metadata->getOptionalString('discoURL', null))) {
              $metadata['DiscoveryResponse'] = $this->getDiscoveryResponseEndpoints();
        }
...
  • Method B: Allow the choice of whether to use the DiscoveryResponse extension. Requires a parameter in authsources.php.
    'disable.DiscoveryResponse' => true,
    /**
     * Retrieve the metadata array of this SP, as a remote IdP would see it.
     *
     * @return array The metadata array for its use by a remote IdP.
     */
    public function getHostedMetadata(): array
    {
        $entityid = $this->getEntityId();
        $metadata = [
            'entityid' => $entityid,
            'metadata-set' => 'saml20-sp-remote',
            'SingleLogoutService' => $this->getSLOEndpoints(),
            'AssertionConsumerService' => $this->getACSEndpoints(),
        ];

        // METHOD B: Disable DiscoveryResponse explicitly through a config parameter in authsources.php
        if (!($this->metadata->getOptionalBoolean('disable.DiscoveryResponse', false))) {
                $metadata['DiscoveryResponse'] = $this->getDiscoveryResponseEndpoints();
        }
...

Here is an example of metadata obtained by applying method B.:

filesender-sp.xml

Additional context

I have not yet tested with one of the latest versions of SwitchWAYF, but it seems to me that the solution could be either:

  • not overloading the SP metadata with this namespace if an external Discovery Service is used by specifying its URL in authsources.php with “discoURL” => “<url_of_the_remote_DS>/”, (=Method A)

  • allowing sysadmins to enable or disable ‘support for IDP Discovery protocol’ with a configuration parameter (=Method B)

Here is the error we get with SSP >2.4.0 and SwitchWAYF, without the code modification suggested above, after authentication by our IdPs:

Image
Conclusion

Do you agree with any of the suggestions above?
I'll leave it up to you to decide which of my suggestions is the best solution.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 modules/saml/src/Auth/Source/SP.php 开始,检查 getHostedMetadata(),以及 discoURL 和 SP 元数据选项如何从 authsources.php 中读取。比较所提出的方法,并验证当所选配置禁用它时,生成的 SP 元数据不再包含 idp-discovery-protocol DiscoveryResponse。

由索引模型根据 Issue 内容生成。

评估

技术栈
php
领域
authentication
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。