title: LDAP Authentication with Laravel4
body: <p>Please help me with LDAP Authentication with Laravel4.</p>
  
  <p>My configuration below always return false</p>
  
  <p>I have my <strong>auth.php</strong> like this :</p>
  
  <pre><code>&lt;?php
  
  return array(
  
  /*
  |--------------------------------------------------------------------------
  | Default Authentication Driver
  |--------------------------------------------------------------------------
  |
  | This option controls the authentication driver that will be utilized.
  | This driver manages the retrieval and authentication of the users
  | attempting to get access to protected areas of your application.
  |
  | Supported: "database", "eloquent"
  |
  */
  
  //'driver' =&gt; 'eloquent',
  'driver' =&gt; 'ldap',
  
  /*
  |--------------------------------------------------------------------------
  | Authentication Model
  |--------------------------------------------------------------------------
  |
  | When using the "Eloquent" authentication driver, we need to know which
  | Eloquent model should be used to retrieve your users. Of course, it
  | is often just the "User" model but you may use whatever you like.
  |
  */
  'username_field' =&gt; 'username',
  
  'model' =&gt; 'User',
  
  /*
  |--------------------------------------------------------------------------
  | Authentication Table
  |--------------------------------------------------------------------------
  |
  | When using the "Database" authentication driver, we need to know which
  | table should be used to retrieve your users. We have chosen a basic
  | default value but you may easily change it to any table you like.
  |
  */
  
  'table' =&gt; 'users',
  
  /*
  |--------------------------------------------------------------------------
  | Password Reminder Settings
  |--------------------------------------------------------------------------
  |
  | Here you may set the settings for password reminders, including a view
  | that should be used as your password reminder e-mail. You will also
  | be able to set the name of the table that holds the reset tokens.
  |
  | The "expire" time is the number of minutes that the reminder should be
  | considered valid. This security feature keeps tokens short-lived so
  | they have less time to be guessed. You may change this as needed.
  |
  */
  
  'reminder' =&gt; array(
  
      'email' =&gt; 'emails.auth.reminder',
  
      'table' =&gt; 'password_reminders',
  
      'expire' =&gt; 60,
  
  ),
  
  );
  </code></pre>
  
  <p>and my <strong>app/config/adldap.php</strong> like this :</p>
  
  <pre><code>&lt;?php
  
  return array(
      'account_suffix' =&gt; "@pusat.corp.pln.co.id",
  'domain_controllers' =&gt; array("dc01.pusat.corp.pln.co.id","pusat.corp.pln.co.id"), // An array of domains may be provided for load balancing.
  
  'base_dn' =&gt; 'DC=pusat','DC=corp','DC=pln','DC=co','DC=id',
  
  
  'real_primary_group' =&gt; true, // Returns the primary group (an educated guess).
  
  'use_ssl' =&gt; false, // If TLS is true this MUST be false.
  
  'use_tls' =&gt; false, // If SSL is true this MUST be false.
  
      'recursive_groups' =&gt; true,
  
  );
  </code></pre>
  
  <p><strong>in routes.php</strong></p>
  
  <pre><code>Route::post('login', function () {
      $passhash = Input::get('password');
      $credentials  = array(
          'username' =&gt; Input::get('username'),
          'password' =&gt; Input::get('password')
      );
  
  
      if ($a = Auth::attempt($credentials))
          return '&lt;pre&gt;' . print_r(Auth::user(), true);
      else
          dd($a);
  });
  </code></pre>