2
パスワードリセット機能のためにPHPで別のユーザー(管理ユーザー)として接続したときにLDAPユーザーパスワードをリセットする方法を解明しようとしています。 (クラスメソッドから集約)PHPで古いパスワードを使わずにLDAPユーザーのパスワードをリセットする(adminユーザーを使用)
$this->con = ldap_connect($this->server);
ldap_set_option($this->con, LDAP_OPT_PROTOCOL_VERSION, 3);
$user_search = ldap_search($this->con, $this->dn,"(|(uid=$user)(mail=$user))");
$this->user_get = ldap_get_entries($this->con, $user_search);
$user_entry = ldap_first_entry($this->con, $user_search);
$this->user_dn = ldap_get_dn($this->con, $user_entry);
$this->user_id = $this->user_get[0]["uid"][0];
$entry = array();
$entry["userPassword"] = "$encoded_newPassword";
ldap_modify($this->con, $this->user_dn, $entry)
これは、古いパスワードを使用して、ユーザーのパスワードをリセットするために動作しますが、どのように別のユーザー(この場合は管理者)とパスワードの変更をやって行くのでしょうか?
私は理解していないLDAP認証/バインドについては何かと思います。おそらく誰かが私を正しい方向に向けることができます。
ldap_modifyの前にldap_bindを実行すると、user_dnを使用して管理ユーザーとしてユーザーを更新できますか?
これがどのように機能するかは不明です。
OpenLDAPは使用されている実装です。