【问题标题】:Add custom attributes to response with simplesaml使用 simplesaml 为响应添加自定义属性
【发布时间】:2019-06-12 15:28:15
【问题描述】:

我正在将 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 很陌生,所以我不确定是否还需要做任何其他事情来完成这项工作。

【问题讨论】:

  • 属性必须是字符串或字符串数​​组。您正在使用布尔值true。您可以将其切换为字符串'true' o '1'

标签: saml simplesamlphp idp


【解决方案1】:

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

'{sp_name}访问 => 真

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-13
    • 2012-07-10
    • 1970-01-01
    • 1970-01-01
    • 2019-03-04
    • 1970-01-01
    • 2011-11-28
    • 2023-03-17
    相关资源
    最近更新 更多