如何在POST请求中将其他参数从IdP发送到SP


How to send other paramenters from the IdP to the SP in the POST request?

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

配置文件的主要部分:

配置/config。

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

配置/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

我试过使用"添加属性(core:AttributeAdd)"方法,但不起作用。这可能吗?这方面的任何文档、资源或示例都会有所帮助。

谢谢。

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

  1. 在授权查询中,我为用户"name"设置了别名"givenName"。
  2. 在idp-hosted中,在"authproc"key中,我使用de AttributeMap方法添加了"givenName"。

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

有人可以告诉我为什么?参数名不可配置?可能是SP和IdP必须在两边配置相同的名称?