adldap2 laravel它只返回'false'

I'm trying to use the adldap2 to access an adldap server.

it's everything ok with the server, i have used the Apache Directory Studio to test it.

I have followed all these instructions but withou success. All of my requests are returning 'false' or a empty collection.

what am i doing wrong?

Here are my files:

# \config\ldap.php 
return [

    'logging' => env('LDAP_LOGGING', false),

    'connections' => [

        'default' => [

            'auto_connect' => env('LDAP_AUTO_CONNECT', true),

            'connection' => Adldap\Connections\Ldap::class,

            'settings' => [

                'schema' => Adldap\Schemas\ActiveDirectory::class,

                'account_prefix' => env('LDAP_ACCOUNT_PREFIX', ''),

                'account_suffix' => env('LDAP_ACCOUNT_SUFFIX', ''),

                'hosts' => explode(' ', env('LDAP_HOSTS', 'ldap.forumsys.com')),

                'port' => env('LDAP_PORT', 389),

                'timeout' => env('LDAP_TIMEOUT', 5),

                'base_dn' => env('LDAP_BASE_DN', 'dc=example,dc=com'),

                'username' => env(' cn=read-only-admin,dc=example,dc=com'),
                'password' => env('password'),

                'follow_referrals' => false,

                'use_ssl' => env('LDAP_USE_SSL', false),
                'use_tls' => env('LDAP_USE_TLS', false),

            ],

        ],

    ],

];

To test I using the web.php directly:

<?php

use Adldap\Laravel\Facades\Adldap;

Route::get('/api', function(){

    $user = Adldap::search()->users()->find('newton');
    dd($user);
    return 'test page';
});

Here is my response error

false response result

1个回答

Normaly a "false" is returned if there is an error in your Query or LDAP Settings. You could try to get the error with the ldap_error function.

In adldab2 there should be an method in your Connection from your Provider

$ad = new \Adldap\Adldap();
$config = [...]; // your config
$ad->addProvider($config);
$provider = $ad->connect();
// do your query stuff
$provider->getConnection()->getLastError()
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问