summaryrefslogtreecommitdiff
path: root/src/Helpers/AuthenticatorServiceProvider.php
blob: 3534618da5f5e75d553ba2054a0122313002a179 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

namespace Engelsystem\Helpers;

use Engelsystem\Config\Config;
use Engelsystem\Container\ServiceProvider;

class AuthenticatorServiceProvider extends ServiceProvider
{
    public function register()
    {
        /** @var Config $config */
        $config = $this->app->get('config');
        /** @var Authenticator $authenticator */
        $authenticator = $this->app->make(Authenticator::class);
        $authenticator->setPasswordAlgorithm($config->get('password_algorithm'));
        $authenticator->setGuestRole($config->get('auth_guest_role', $authenticator->getGuestRole()));

        $this->app->instance(Authenticator::class, $authenticator);
        $this->app->instance('authenticator', $authenticator);
        $this->app->instance('auth', $authenticator);
    }
}