- Laravel Version: 5.5
- Adldap2-Laravel Version: 4.0
- PHP Version: 7.2.3
- LDAP Type: OpenLDAP
Description:
Hello!
Im able to authenticate successfully but Im not redirected past the login screen. The logs show everything worked but Im returned to the /login again with out any errors.
Im only interested in the authentication part. No need to save anything to a database (NoDatabaseUserProvider).
local.INFO: User '{MyUserName}' has been successfully found for authentication.
local.INFO: User '{MyUserName}' is authenticating with username: 'uid={uid},cn=users,dc=mydomain,dc=com'
local.INFO: User '{MyUserName}' has successfully passed LDAP authentication.
local.INFO: User '{MyUserName}' has been successfully logged in.
Steps To Reproduce:
Every login is an endless loop. If I try to visit the url mydomain.com/home, I'm redirected to /login again.
.env
ADLDAP_CONTROLLERS='mydomain.com'
ADLDAP_BASEDN='cn=users,dc=mydomain,dc=com'
CACHE_DRIVER=file
SESSION_DRIVER=file
adldap_auth.php
return [
'connection' => env('ADLDAP_CONNECTION', 'default'),
'provider' => Adldap\Laravel\Auth\NoDatabaseUserProvider::class,
'rules' => [Adldap\Laravel\Validation\Rules\DenyTrashed::class],
'scopes' => [Adldap\Laravel\Scopes\UidScope::class],
'usernames' => [
'ldap' => [
'discover' => 'uid',
'authenticate' => 'dn'
]
],
'login_fallback' => env('ADLDAP_LOGIN_FALLBACK', false),
'sync_attributes' => [
'username' => 'uid',
'name' => 'cn',
]
];
adldap.php
return [
'connections' => [
'default' => [
'auto_connect' => env('ADLDAP_AUTO_CONNECT', true),
'connection' => Adldap\Connections\Ldap::class,
'schema' => Adldap\Schemas\OpenLDAP::class,
'connection_settings' => [
'account_prefix' => env('ADLDAP_ACCOUNT_PREFIX', ''),
'account_suffix' => env('ADLDAP_ACCOUNT_SUFFIX', ''),
'domain_controllers' => explode(' ', env('ADLDAP_CONTROLLERS', '')),
'port' => env('ADLDAP_PORT', 389),
'timeout' => env('ADLDAP_TIMEOUT', 5),
'base_dn' => env('ADLDAP_BASEDN', ''),
'admin_account_prefix' => env('ADLDAP_ADMIN_ACCOUNT_PREFIX', ''),
'admin_account_suffix' => env('ADLDAP_ADMIN_ACCOUNT_SUFFIX', ''),
'admin_username' => env('ADLDAP_ADMIN_USERNAME', ''),
'admin_password' => env('ADLDAP_ADMIN_PASSWORD', ''),
'follow_referrals' => false,
'use_ssl' => env('ADLDAP_USE_SSL', false),
'use_tls' => env('ADLDAP_USE_TLS', false),
],
],
],
];
LoginController.php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
use AuthenticatesUsers;
protected $redirectTo = '/home';
protected $username = 'username';
public function username()
{
return 'uid';
}
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}
login.blade.php
...
<div class="form-group row">
<label for="uid" class="col-sm-4 col-form-label text-md-right">{{ __('User Name') }}</label>
<div class="col-md-6">
<input id="uid" type="text" class="form-control{{ $errors->has('uid') ? ' is-invalid' : '' }}" name="uid" value="{{ old('uid') }}"
required autofocus> @if ($errors->has('uid'))
<span class="invalid-feedback">
<strong>{{ $errors->first('uid') }}</strong>
</span>
@endif
</div>
</div>
...
question OpenLDAP