Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Kristina Petravičiūtė
Kristina Petravičiūtė
11,270 Points

LDAP authentication with Laravel 5

Hi,

I really need your help. I'm trying to connect my laravel 5 project with Active directory, but I'm getting error message: "BadMethodCallException in Validator.php line 2615: Method [validateName] does not exist.".

This is my steps:

  1. I'm using ccovey/ldap-auth so I install them by typing composer require "ccovey/ldap-auth": "1.1.*"

  2. Open config/app.php and find Illuminate\Auth\AuthServiceProvider and replace it with Ccovey\LdapAuth\LdapAuthServiceProvider

  3. Edit auth.php file by changing driver to ldap and add 'username_field' => 'fieldname'

  4. Creating adldap.php file (I changed real names to example, com, name and password for security purposes):

<?php

return [

    'account_suffix' => "@example.com",

    'domain_controllers' => array("dc1.example.com"), // An array of domains may be provided for load balancing.

    'base_dn' => 'DC=example,DC=com',

    'admin_username' => 'name',

    'admin_password' => 'password',

    'real_primary_group' => true, // Returns the primary group (an educated guess).

    'use_ssl' => false, // If TLS is true this MUST be false.

    'use_tls' => false, // If SSL is true this MUST be false.

    'recursive_groups' => true,

];
  1. I have connected to mssql database and have user table migration (if it's needed for authentication?)

  2. In routes.php :

<?php

Route::post('authenticate_user', array('as'=>'auth_user', 

            'uses'=>'HomeController@authenticateUser'));

Route::controllers([

    'auth' => 'Auth\AuthController',

    'password' => 'Auth\PasswordController',

]);

WHAT I'VE MISSED? HELP! Thank you :)

1 Answer

How are you getting on with this one? A bad method call would suggest you're trying to call something that doesn't exist. Is the validator in your error message the Illuminate Validator or an additional service?