Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| AuthenticatorServiceProvider | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| register | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Engelsystem\Helpers; |
| 6 | |
| 7 | use Engelsystem\Config\Config; |
| 8 | use Engelsystem\Container\ServiceProvider; |
| 9 | |
| 10 | class AuthenticatorServiceProvider extends ServiceProvider |
| 11 | { |
| 12 | public function register(): void |
| 13 | { |
| 14 | /** @var Config $config */ |
| 15 | $config = $this->app->get('config'); |
| 16 | /** @var Authenticator $authenticator */ |
| 17 | $authenticator = $this->app->make(Authenticator::class); |
| 18 | $authenticator->setPasswordAlgorithm($config->get('password_algorithm')); |
| 19 | $authenticator->setGuestRole($config->get('auth_guest_role', $authenticator->getGuestRole())); |
| 20 | $authenticator->setDefaultRole($config->get('auth_default_role', $authenticator->getDefaultRole())); |
| 21 | |
| 22 | $this->app->instance(Authenticator::class, $authenticator); |
| 23 | $this->app->instance('authenticator', $authenticator); |
| 24 | $this->app->instance('auth', $authenticator); |
| 25 | } |
| 26 | } |