Custom Laravel Authentication Hash

0

Next, I have a specific bank with specific columns and a specific hash method, I'm migrating to Laravel following the multi tenancy structure.

I would like to know if there is any way to make laravel ignore Bcrypt and accept my Hash form?

If it exists, how could it do?

    
asked by anonymous 19.10.2018 / 15:48

1 answer

2

Just take a look at how hashing default works.

There is no Illuminate\Hashing\HashServiceProvider the following method

public function register()
{
    $this->app->singleton('hash', function () { return new BcryptHasher; });
}

This means, by default, that you are using BcryptHasher as an instance.

If you want to implement hash on your own, you will have to create your own service provider ( Provider ) and façades ( Facades ) to hashing and then swap the default implementations of the config/app.php file.

More precisely, you'll want to swap in the array of providers

Illuminate\Hashing\HashServiceProvider::class , with your own service provider ( providers ), and the same goes for array aliases in the same file.

Then, as an example, take a look at how BcryptHasher implements an interface, and your hash implementation must implement the same interface.

This would extend the hash in Laravel.

  

Complementary Topics

     

Change the hash used for login to laravel 5.4

     

Adding Custom User Providers

     

Custom auth and hashing laravel 5.1

     

Creating a Hashing Manager For Our Custom Laravel Hashing   Implementations

    
19.10.2018 / 16:01