0

我正在将 simplesaml 设置为 IdP,以便为我的 SP 进行一些测试。我需要为响应添加一个新属性,即 {sp_name}Access。但是,我不知道在哪里添加它们。

我尝试将以下内容添加到saml20-idp-hosted.php

'authproc' => array(
   50 => array(
       'class' => 'core:AttributeAdd',
       '{sp_name}Access' => '{sp_name}Access',
   ),
 )

在我的authsources.php我有这个

'test-users' => array(
    'exampleauth:UserPass',
    'user1:user1pass' => array(
        'uid' => array('1'),
        'eduPersonAffiliation' => array('group1'),
        'email' => 'user1@example.com',
        'givenName' => 'User',
        'surname' => 'One',
        '{sp_name}Access => true
    ),
),

但是它给了我这个错误

Backtrace:
1 www/_include.php:45 (SimpleSAML_exception_handler)
0 [builtin] (N/A)
Caused by: Exception: Invalid attributes for user user1 in authentication source test-users: Invalid attribute value for attribute loopioAccess: "1".
Backtrace:
6 modules/exampleauth/lib/Auth/Source/UserPass.php:55 (sspmod_exampleauth_Auth_Source_UserPass::__construct)
5 lib/SimpleSAML/Auth/Source.php:302 (SimpleSAML_Auth_Source::parseAuthSource)
4 lib/SimpleSAML/Auth/Source.php:343 (SimpleSAML_Auth_Source::getById)
3 lib/SimpleSAML/Auth/Simple.php:56 (SimpleSAML\Auth\Simple::getAuthSource)
2 lib/SimpleSAML/Auth/Simple.php:160 (SimpleSAML\Auth\Simple::login)
1 modules/core/www/authenticate.php:36 (require)
0 www/module.php:135 (N/A)

任何想法如何实际添加自定义属性?我对 simplesaml 很陌生,所以我不确定是否还需要做任何其他事情来完成这项工作。

4

1 回答 1

0

好吧,您的 authsources.php 在您提供的以下键/值对中的键后缺少引号......这可能是罪魁祸首。

'{sp_name}访问 => 真

于 2019-12-30T16:13:41.987 回答