duanri1985 2019-04-23 01:04
浏览 143
已采纳

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条回答 默认 最新

  • doupao3662 2019-04-23 09:54
    关注

    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()
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器