lundi 1 février 2016

Laravel 5 - LDAP Authentication

I am using the following library to authenticate users against Active Directory http://ift.tt/20j2J9p

Following the instructions is straight forward, and once I do

$user = Auth::user();

I can see if a user is authenticated. However, in the instructions, it also links to the following http://ift.tt/1P9Viqn

From what I could understand, I thought I could do something like the following

$user = Auth::user()->infoCollection('myusername', array('*'));

However, this returns the error

Call to undefined method Dsdevbe\LdapConnector\Model\User::infoCollection()

This is because infoCollection is not a function defined within the User model. If I want to do what I am attempting above, I would have to do

$options = array(
    'account_suffix'=>'@something.local',
    'domain_controllers' => ['something.local'],
    'base_dn' => 'DC=Mailtrack,DC=local',
    'admin_username' => 'something',
    'admin_password' => 'something'
);

$adldap = new adLDAP($options);
$user = $adldap->user()->infoCollection('someusername', array('*'));

However, if I do this, I am no longer running on the User Model I do not think.

So my main question is, how can I use functions like infoCollection on my User Model?

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire