簡體   English   中英

如何使用PHP設置多個LDAP對象類?

[英]How to set multiple LDAP object classes with PHP?

我正在嘗試從Shibboleth / SAML IdP接收用戶數據並將其傳遞到LDAP:

// Get data from IdP
$attributes = getUserFromIdP();

// Connect + bind (simplified)
$ldapconn = ldap_connect();
ldap_bind();

// Prepare data
$info['uid']                    = $attributes['uid'][0];
$info['givenName']              = $attributes['givenName'][0];
$info['sn']                     = $attributes['sn'][0];
$info['cn']                     = $attributes['cn'][0];
$info['mail']                   = $attributes['mail'][0];
$info['objectclass'][]          = 'inetOrgPerson';
$info['objectclass'][]          = 'eduPerson'; // problem here!

$dn = "cn=".$info['cn'].",dc=sub,dc=domain,dc=tld";
$r = ldap_add($ldapconn, $dn, $info);

如果我僅將inetOrgPerson添加為objectclass它將很好地工作。 但是,當我嘗試同時獨占設置eduPerson或同時設置兩者時,會收到Invalid syntax錯誤(錯誤代碼21)。

它似乎沒有缺少必需的屬性(這將引發Object class violation錯誤)。 那么這里的問題是什么,我該如何解決呢?

我找到了答案:我需要先導入eduPerson模式。 (更具體的錯誤消息會有所幫助...)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM