So I'm attempting to authenticate my user's using Laravel's custom filters. I have my LDAP PHP script working and I have essentially plugged it in to my custom filter. However, I need to pass this script the username and password that the user enters on the log in screen; in other words, I need to pass my custom filter this username and password from the log in form.
Here is my code to help explain my problem:
routes.php
Route::group(array('before' => 'ldapTest'), function() {
Route::controller('apps', 'AppController', array(
//named routes here
));
});
filters.php
Route::filter('ldapTest', function()
{
$username = //how do I get this?
$password = //how do I get this?
//LDAP logic goes here; assume $ldapConn and $userDN are properly initialized
$userBind = @ldap_bind($ldapConn, $userDN, $password);
if($userBind)
{
Auth::login(//What goes here? I want to access $username later on in applications);
return Redirect::to('apps/home');
}
else
{
echo 'Incorrect password';
}
});
From reading the documentation I understand you can pass parameters as strings to filters like so: Route::filter('ldapTest:400', function(), but I don't understand how I could use this to pass my username and password using what I assume would be Input::get().
How can I do this?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community