【问题标题】:How to send other paramenters from the IdP to the SP in the POST request?如何在 POST 请求中从 IdP 向 SP 发送其他参数?
【发布时间】:2015-10-22 08:08:44
【问题描述】:

我已使用 SimpleSAMLphp 配置了 SSO 系统的标识提供程序 (IdP) 部分。

我的配置文件的主要部分:

config/config.php

$config = array(
    [...]
    'enable.saml20-idp' => true,
    'enable.shib13-idp' => true,
    [...]
);

config/authsources.php

$config = array(
    [...]
    '*-sql' => array(
        'sqlauth:SQL',
        'dsn' => 'mysql:host=*.*.*.*;port=*;dbname=*',
        'username' => '*',
        'password' => '*',
        'query' => 'SELECT *
                    FROM users
                    WHERE username = *
                    AND password = *',
     ),
    [...]
);

元数据/saml20-idp-hosted.php

$metadata['__DYNAMIC:1__'] = array(
    'host' => '__DEFAULT__',
    'privatekey' => '../cert/*.key',
    'certificate' => '../cert/*.pem',
    'auth' => '*-sql',
    'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',
    'authproc' => array(
            3 => array(
                    'class' => 'saml:AttributeNameID',
                    'attribute' => 'uid',
                    'Format' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',
            ),
    ),
);

元数据/saml20-idp-remote.php

$metadata['https://www.video2brain.com/shibboleth'] = array(
    'AssertionConsumerService' => 'http://*/Shibboleth.sso/SAML2/POST',
    'SingleSignOnService'      => 'http://*/Shibboleth.sso/SAML2/POST',
    'SingleLogoutService'      => 'http://*/Shibboleth.sso/SLO/POST',
);

证书和元数据已成功配置。 SSO 工作正常。

但服务提供商 (SP) 已要求 IdP 必须传递登录用户的更多信息。当查询返回一行时,身份验证通过,但我无法访问 SELECT 中的字段。

目前,我的 IdP 发送给其 SP 的最终 POST 请求具有以下参数:

HTTP_SHIB_IDENTITY_PROVIDER=https://*/metadata.php,
HTTP_SHIB_AUTHENTICATION_INSTANT=2015-10-20T09:04:42Z,
HTTP_SHIB_AUTHENTICATION_METHOD=urn:oasis:names:tc:SAML:2.0:ac:classes:Password,
HTTP_SHIB_AUTHNCONTEXT_CLASS=urn:oasis:names:tc:SAML:2.0:ac:classes:Password,
HTTP_EMAIL=*@*.*,
HTTP_PERSISTENT_ID=!https://*/shibboleth-sp!6faa919dda0e40e5e42088bcd9beb639ed4dfa5e

他们希望在新参数中包含用户的全名。类似的东西:

[...]
HTTP_USER_NAME=FooUserName

我曾尝试使用“添加属性(核心:AttributeAdd)”方法,但不起作用。有可能这样做吗?任何文档、资源或示例都会有所帮助。

谢谢。

【问题讨论】:

    标签: php saml-2.0 simplesamlphp


    【解决方案1】:

    我将参数设置为“givenName”而不是“name”,它可以工作!

    1. 在身份验证查询中,我将用户“name”的别名设置为“givenName”。
    2. 在 idp 托管的“authproc”键中,我使用 de AttributeMap 方法添加了“givenName”。

    我以前做过这些事情,但我试图使用“name”作为最终参数“name”,直到我使用“givenName”才起作用。

    谁能告诉我为什么? 参数名称不可配置? 可能是SP和IdP两边都要配置同名?

    【讨论】:

      猜你喜欢
      • 2014-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-11
      • 2019-01-13
      • 1970-01-01
      相关资源
      最近更新 更多