0
我有我的LDAP与现有的LDAP系统,具备以下条件连接: 使用域名是12.14.4.38 用户名0000001和密码123456如何我LDAP与现有的LDAP系统连接在Laravel 5.4
我打开了这个link,但我仍然不明白如何使用它。这是我的adldap.php代码
<?php
return [
'connections' => [
'default' => [
'auto_connect' => true,
'connection' => Adldap\Connections\Ldap::class,
'schema' => Adldap\Schemas\ActiveDirectory::class,
'connection_settings' => [
'account_prefix' => env('ADLDAP_ACCOUNT_PREFIX', ''),
'account_suffix' => env('ADLDAP_ACCOUNT_SUFFIX', ''),
'domain_controllers' => explode(' ', env('ADLDAP_CONTROLLERS', '12.14.4.38')),
'port' => env('ADLDAP_PORT', 389),
'timeout' => env('ADLDAP_TIMEOUT', 5),
'base_dn' => env('ADLDAP_BASEDN', 'dc=12.14.4.38'),
'admin_account_suffix' => env('ADLDAP_ADMIN_ACCOUNT_SUFFIX', ''),
'admin_username' => env('ADLDAP_ADMIN_USERNAME', '0000001'),
'admin_password' => env('ADLDAP_ADMIN_PASSWORD', '123456'),
'follow_referrals' => false,
'use_ssl' => false,
'use_tls' => false,
],
],
],
];
// Create a new Adldap Provider instance.
$provider = new \Adldap\Connections\Provider(connections);
$ad = new \Adldap\Adldap(connections);
try {
// Connect to the provider you specified in your configuration.
$provider = $ad->connect('default');
// Connection was successful.
// We can now perform operations on the connection.
$user = $provider->search()->users()->find('0000001');
} catch (\Adldap\Auth\BindException $e) {
die("Can't connect/bind to the LDAP server! Error: $e");
}
对不起太久答复。好的,我会试一试。我几乎感到沮丧的原因。我会尽快尝试并将结果告诉你。如果我发现问题,我希望你能再次帮助我。谢谢@ R.J。 –
gheghe ....否则团队查看器会话,我可以帮你设置它比输入答复更快 –
对不起,只是回复。我昨天不适合。 错误..所以..我应该把这东西放在哪里? 搜索主机:12.14.4.38 basedn:“ou = Users,dc = DRiski,dc = com”< - 我以您的用户名为例 admin:“cn = admin,ou = admins,dc = DRiski,dc = com“ 密码:只是普通密码 在我的adldap.php ??? –