Upgrading from Laravel 5.5 to Laravel 9

I am upgrading an Laravel version for an old project. But I have encountered an issues with updating the AuthServiceProvider. It looks like the “validator()” method on line “Password::broker()->validator(function ($credentials) {” has been removed. Could someone give me a suggestion on how to fix it in the upgrade? I could do it differently, but I wanted to know if there was a new way to use the “validator()” method.


namespace AppProviders;

use AppHttpFormsSitesLogin;
use AppHttpFormsResetPassword;
use AppHttpFormsForgotPassword;
use IlluminateSupportFacadesPassword;
use StoneFormsHandlersLaravelFormBuilder;
use IlluminateFoundationSupportProvidersAuthServiceProvider as ServiceProvider;


class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        'AppModel' => 'AppPoliciesModelPolicy',
    ];

    /**
     * Register any authentication / authorization services.
     *
     * @return void
     */
    public function boot()
    {
        $this->registerPolicies();

        $this->app['forms']->register(
            'forgot-password',
            new LaravelFormBuilder(view(), ForgotPassword::class)
        );

        $this->app['forms']->register(
            'reset-password',
            new LaravelFormBuilder(view(), ResetPassword::class)
        );

        $this->app['forms']->register(
            'site-login',
            new LaravelFormBuilder(view(), Login::class)
        );

        Password::broker()->validator(function ($credentials) {
            return $credentials['password'] === $credentials['password_confirmation'];
        });
    }
}