Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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?