将自定义属性添加到SimpleSAMLPhp

时间:2014-01-06 23:22:09

标签: saml-2.0 simplesamlphp

我正在使用此页面作为参考指南:core:PHP

它读取为应用于我的LDAP中已存在的属性,但如果我想完全添加新属性该怎么办?

我添加了以下两个新的;第一个是重命名为新的,第二个是静态的:

saml20-idp-hosted.php
_____________________
   100 => array(
    'class' => 'core:PHP',
    'code' => '
        if (!empty($attributes["blahblahID"])) {
              $employeeID = $attributes["blahblahID"][0];
              $attributes["employeeID"] = array($employeeID);
        }
        $attributes["securityKey"] = array("123456");
        if (!empty($attributes["displayname"])) {
              $displayname = $attributes["displayname"][0];
              $attributes["UserName"] = array($displayname);
        }
    ',
),

saml20-sp-remote.php
____________________
$metadata['Corestream'] = array(
    'metadata-set' => 'saml20-sp-remote',
    'simplesaml.attributes'      => true,
    'attributes' => array('UserName','employeeID','securityKey'),
.........

employeeID和securityKey属性会以这种方式自动传递给SP吗?

编辑:

我能够运行测试并且从SP收到错误,即属性UserName不存在。我做错了什么?

1 个答案:

答案 0 :(得分:1)

为此,您最好使用core:AttributeMapcore:AttributeAdd。核心的用法:由于PHP推荐against这些类型的结构,因此通常不建议使用PHP模块。如果您真的需要包含AuthProc过滤器不提供的内容,请考虑编写自己的内容。