AppServiceProvider.php 3.23 KB
Newer Older
1
2
3
4
5
<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
6
use Source\Authorization\AuthorizerServiceProvider;
7
use Source\Gateways\Saml\SamlRepositoryServiceProvider;
8
use Source\Gateways\Doors\DoorsRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
9
use Source\Gateways\Users\UsersRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
10
use Source\Gateways\Groups\GroupsRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
11
use Source\Gateways\Tokens\TokensRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
12
use Source\UseCases\Users\GetUser\GetUserUseCaseServiceProvider;
13
use Source\Gateways\GroupUser\GroupUserRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
14
use Source\UseCases\Users\CreateUser\CreateUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
15
use Source\UseCases\Users\DeleteUser\DeleteUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
16
use Source\UseCases\Users\UpdateUser\UpdateUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
17
use Source\UseCases\Users\GetAllUsers\GetAllUsersUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
18
use Source\UseCases\Groups\CreateGroup\CreateGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
19
use Source\UseCases\Groups\DeleteGroup\DeleteGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
20
use Source\UseCases\Token\Authenticate\AuthenticateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
21
use Source\UseCases\Groups\GetAllGroups\GetAllGroupsUseCaseServiceProvider;
22
use Source\UseCases\Doors\Authenticate\AuthenticateUseCaseServiceProvider as DoorAuthenticateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
23
use Source\UseCases\Users\Authenticate\AuthenticateUseCaseServiceProvider as UserAuthenticateUseCaseServiceProvider;
24
25
26

class AppServiceProvider extends ServiceProvider
{
27
28
29
30
    /**
     * @var string[]
     */
    protected array $gatewayProviders = [
31
        AuthorizerServiceProvider::class,
32
        SamlRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
33
        UsersRepositoryServiceProvider::class,
34
        DoorsRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
35
        TokensRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
36
        GroupsRepositoryServiceProvider::class,
37
        GroupUserRepositoryServiceProvider::class,
38
39
40
41
42
43
    ];

    /**
     * @var string[]
     */
    protected array $useCaseProviders = [
Jacob Priddy's avatar
Jacob Priddy committed
44
        // Users
Jacob Priddy's avatar
Jacob Priddy committed
45
        GetUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
46
        DeleteUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
47
        UpdateUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
48
        CreateUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
49
        GetAllUsersUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
50

Jacob Priddy's avatar
Jacob Priddy committed
51
52
        // Groups
        CreateGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
53
        DeleteGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
54
        GetAllGroupsUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
55
56

        // Doors
Jacob Priddy's avatar
Jacob Priddy committed
57
        AuthenticateUseCaseServiceProvider::class,
58
        DoorAuthenticateUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
59
        UserAuthenticateUseCaseServiceProvider::class,
60
61
    ];

62
63
64
65
66
67
68
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
69
        // We register gateways first, as use cases will generally use gateways
70
71
        // Not that it actually matters because they are all deferred anyway
        // and will all be registered before any need to be created.
72
73
74
75
76
77
78
        foreach ($this->gatewayProviders as $gatewayProvider) {
            $this->app->registerDeferredProvider($gatewayProvider);
        }

        foreach ($this->useCaseProviders as $useCaseProvider) {
            $this->app->registerDeferredProvider($useCaseProvider);
        }
79
80
81
82
83
84
85
86
87
88
89
90
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }
}