SimpleSamlphp:在另一个属性中添加属性

SimpleSamlphp : add attribut inside another attribut

我实际上使用 simpleSamlPhp 在我的网站上创建身份验证,所以我在我的网站上安装了一个服务提供商,我还安装了一个身份提供商,直到他们没问题。我的服务提供商连接到我的身份提供商并且连接工作正常。

我在文件中有 "config/authsources.php" 我的不同用户:

$config = array(
    ...
    'example-userpass' => array(
        'userTest:pwd' => array(
            'uid' => array('userTest'),
            'NameIdentifier' => 'Test',
            'Attribut1' => 'att1',
            'Attribut2' => 'att2'
        )
    ),
    ...
),
...

我的问题是我想在一个属性中有一个包含多个属性的属性,因为有类似的东西:

$config = array(
    ...
    'example-userpass' => array(
        'userTest:pwd' => array(
            'uid' => array('userTest'),
            'NameIdentifier' => 'Test',
            'Attribut1' => 'att1',
            'Attribut2' => array(
                'Attribut21' =>  'att21',
                'Attribut22' => 'att22',
                 ...    
            )
        )
    ),
    ...
),
...

但是当我这样做的时候出现了这个错误:

SimpleSAML_Error_Error: UNHANDLEDEXCEPTION
Backtrace:
1 C:\wamp\www\Idp\simplesamlphp\www\_include.php:37 (SimpleSAML_exception_handler)
0 [builtin] (N/A)
Caused by: Exception: Invalid attributes for user userTest in authentication source example-userpass: Invalid attribute value for attribute Attribut2: array (
  'Attribut21' => 'att21',
  'Attribut22' => 'att22'
)

那么如何添加一个属性和其他属性?

改变

'Attribut21' =  'att21',
'Attribut22' = 'att22',

'Attribut21' =>  'att21',
'Attribut22' => 'att22',

因为它们应该是 associative array

编辑:好的,不确定这里有什么问题......我要 post 举个例子,希望你能理解这个模式。 (每个数组其实是更多的属性)

<?php
$config = array(
    'example-userpass' => array(
        'exampleauth:UserPass',
        'student:studentpass' => array(
            'uid' => array('student'),
            'eduPersonAffiliation' => array('member', 'student'),
        ),
        'employee:employeepass' => array(
            'uid' => array('employee'),
            'eduPersonAffiliation' => array('member', 'employee'),
        ),
    ),
);

其实并不难,最后我只需要做 :

$config = array(
    ...
    'example-userpass' => array(
        'userTest:pwd' => array(
            'uid' => array('userTest'),
            'NameIdentifier' => 'Test',
            'Attribut1' => 'att1',
            'Attribut2' => array(
                'att21',
                'att22',
                 ...    
            )
        )
    ),
    ...
),
...