【问题标题】:How to integrate simplesamlphp library and update configuration when composer update in Zend Framework3Zend Framework3中composer更新时如何集成simplesamlphp库和更新配置
【发布时间】:2019-04-15 11:03:52
【问题描述】:

我使用 composer 安装了 SIMPLESAMLPHP 库

作曲家需要 simplesamlphp/simplesamlphp

对于配置,我需要在我的 SIMPLESAMLPHP 库根目录中添加 saml-autoconfig.php 文件。但我的供应商文件夹位于 .gitignore 文件中。

当我使用 saml-autoconfig.php 文件更新我的作曲家@production 整个配置时会丢失。

当我的作曲家更新时,我需要配置它。

如果有人有想法,请帮忙

我需要添加以下配置文件

1) 在 saml-autoconfig.php 中。

$metadata_url_for = array(
    /* WARNING WARNING WARNING
     *   You MUST remove the testing IdP (idp.oktadev.com) from a production system,
     *   as the testing IdP will allow ANYBODY to log in as ANY USER!
     * WARNING WARNING WARNING
     * For testing with http://saml.oktadev.com use the line below:
     */
     // 'test' => 'http://idp.oktadev.com/metadata',
);

2)供应商/simplesamlphp/config.php

'baseurlpath'=>''

3)供应商/simplesamlphpauthsources.php

 'default-sp'=>''  //its default one .I want to add more sp.

我如何动态添加 saml-autoconfig.php 这个文件并设置我的配置。

【问题讨论】:

  • 如何在我的控制器中包含/使用 simplesamlphp 库并创建对象表单库,如 $as = new SimpleSAML_Auth_Simple($sp);

标签: php zend-framework simplesamlphp


【解决方案1】:

如果您想在 composer 完成安装/更新过程后执行命令,您可以使用 post-install-cmdpost-update-cmd 选项。

在这种情况下,假设config 文件夹包含您的配置,您需要将其添加到您的composer.json

{
    "require": {
        "simplesamlphp/simplesamlphp": "^1.17"
    },
    "scripts": {
        "post-install-cmd": [
            "cp ./config/config.php ./vendor/simplesamlphp/config.php",
            "cp ./config/authsources.php ./vendor/simplesamlphp/authsources.php"
        ],
        "post-update-cmd": [
            "cp ./config/config.php ./vendor/simplesamlphp/config.php",
            "cp ./config/authsources.php ./vendor/simplesamlphp/authsources.php"
        ]
    }
}

我还下载了simplesamlphp库,你报告的路径好像不对。安装配置文件的正确路径应该是vendor/simplesamlphp/simplesamlphp/config

【讨论】:

  • 还有一个问题。我在 IDP 中添加了中继状态localhost:8080/index.php/?saml_sso=example。我正在尝试测试@local enviornment。是否可以使用端口?
  • 我没用过这个库,不知道能不能用。最好看看这个:github.com/simplesamlphp/simplesamlphp/issues/337
猜你喜欢
  • 2016-08-12
  • 2022-11-09
  • 2021-03-25
  • 1970-01-01
  • 2015-01-28
  • 1970-01-01
  • 2016-08-27
  • 2019-04-13
相关资源
最近更新 更多