Ok, so there is some documentation on this, which I've followed (https://github.com/Adldap2/Adldap2-Laravel), but I cannot seem to get this working. I'm also using laravel 5.3 so I don't know if that has something to do with it. And please bear with me as I'm new to laravel.
I cannot authenticate using the Auth::attempt($creds) method.
I can, however authenticate with Adldap::user()->attempt($user,$pass)
I want to use the Auth facade so I can verify logins and such. If there is another way to do it without using Auth I'm all ears.
I also want to bind to the User model once that user has logged in, but I haven't gotten far enough to see if that works.
I've been working on this for a few days and I think it's time I reach out. Please help!
Here's what I'm working with...
adldap.php:
'auto_connect' => false,
adldap_auth.php:
'bind_user_to_model' => env('ADLDAP_BIND_USER_TO_MODEL', true)
auth.php:
'providers' => [
'users' => [
'driver' => 'adldap',
'model' => App\Models\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
app.php:
'aliases' => [
'Adldap' => Adldap\Laravel\Facades\Adldap::class,
]
'providers' => [
Adldap\Laravel\AdldapServiceProvider::class,
]
controller:
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Http\Requests;
use Illuminate\Support\Facades\Input;
class LoginController extends Controller
{
public function login()
{
$input = Input::all();
if(Auth::attempt([$input['username'],$input['password']])
{
return 'Authenticated';
}
}
}
User model:
namespace App\Models;
use Adldap\Laravel\Traits\AdldapUserModelTrait;
use Illuminate\Auth\Authenticatable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Database\Eloquent\Model;
class User extends Model implements AuthenticatableContract
{
use Authenticatable, AdldapUserModelTrait;
use Authenticatable, AdldapUserModelTrait;
}