I want to change the password
field to user_password
in the SQL request when I use the connection HTTP Basic Authentication. The middleware that I use is auth.basic
specific to Laravel. I managed to change the username by creating middleware, but I can't change the password field.
class CustomBasicAuth extends AuthenticateWithBasicAuth
{
public function handle($request, Closure $next, $guard = null, $field = null)
{
$this->auth->guard($guard)->basic($field ?: 'user_username');
return $next($request);
}
}
I did some research, and I saw that we have to try and modify this method.
/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php
class SessionGuard implements StatefulGuard, SupportsBasicAuth
{
use GuardHelpers, Macroable;
protected function basicCredentials(Request $request, $field)
{
return [$field => $request->getUser(), 'password' => $request->getPassword()];
}
}
Does anyone know how to change it without modifying the base file?