|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Modules\Security\Domain; |
|
4
|
|
|
|
|
5
|
|
|
use App\Infrastructure\Events\Api\ApplicationEventPublisherInterface; |
|
6
|
|
|
use App\Infrastructure\Security\LoggedInUserProviderInterface; |
|
7
|
|
|
use App\Modules\Security\Api\SecurityApiInterface; |
|
8
|
|
|
use App\Modules\Security\Domain\Logic\JWTSecurityListener; |
|
9
|
|
|
use App\Modules\Security\Domain\Logic\SecurityValidator; |
|
10
|
|
|
use App\Modules\Security\Domain\Logic\UserCreator; |
|
11
|
|
|
use App\Modules\Security\Domain\Logic\UserUpdater; |
|
12
|
|
|
use App\Modules\Security\Domain\Repository\UserCreationRepositoryInterface; |
|
13
|
|
|
use App\Modules\Security\Domain\Repository\UserFindingRepositoryInterface; |
|
14
|
|
|
use App\Modules\Security\Domain\Repository\UserUpdatingRepositoryInterface; |
|
15
|
|
|
use App\Modules\Security\Domain\Transactions\SecurityTransactionFactoryInterface; |
|
16
|
|
|
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; |
|
17
|
|
|
use Symfony\Component\Validator\Validator\ValidatorInterface; |
|
18
|
|
|
|
|
19
|
|
|
class SecurityApi implements SecurityApiInterface |
|
20
|
|
|
{ |
|
21
|
|
|
use UserCreator { |
|
22
|
|
|
UserCreator::__construct as __userCreatorConstruct; |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
use UserUpdater { |
|
26
|
|
|
UserUpdater::__construct as __userUpdaterConstruct; |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
use JWTSecurityListener { |
|
30
|
|
|
JWTSecurityListener::__construct as __jwtTokenDecoratorConstruct; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param SecurityTransactionFactoryInterface $transactionFactory |
|
35
|
|
|
* @param UserPasswordHasherInterface $passwordHasher |
|
36
|
|
|
* @param UserCreationRepositoryInterface $creationRepository |
|
37
|
|
|
* @param LoggedInUserProviderInterface $databaseLoggedInUserProvider |
|
38
|
|
|
* @param UserUpdatingRepositoryInterface $updatingRepository |
|
39
|
|
|
* @param UserFindingRepositoryInterface $findingRepository |
|
40
|
|
|
* @param ValidatorInterface $validator |
|
41
|
|
|
* @param ApplicationEventPublisherInterface $eventPublisher |
|
42
|
|
|
*/ |
|
43
|
|
|
public function __construct( |
|
44
|
|
|
SecurityTransactionFactoryInterface $transactionFactory, |
|
45
|
|
|
UserPasswordHasherInterface $passwordHasher, |
|
46
|
|
|
UserCreationRepositoryInterface $creationRepository, |
|
47
|
|
|
LoggedInUserProviderInterface $databaseLoggedInUserProvider, |
|
48
|
|
|
UserUpdatingRepositoryInterface $updatingRepository, |
|
49
|
|
|
UserFindingRepositoryInterface $findingRepository, |
|
50
|
|
|
ValidatorInterface $validator, |
|
51
|
|
|
ApplicationEventPublisherInterface $eventPublisher |
|
52
|
|
|
) |
|
53
|
|
|
{ |
|
54
|
|
|
$securityValidator = new SecurityValidator($validator, $findingRepository); |
|
55
|
|
|
$this->__userUpdaterConstruct($eventPublisher, $transactionFactory, $updatingRepository, $securityValidator, $passwordHasher); |
|
56
|
|
|
$this->__userCreatorConstruct($passwordHasher, $transactionFactory, $creationRepository, $securityValidator); |
|
57
|
|
|
$this->__jwtTokenDecoratorConstruct($databaseLoggedInUserProvider); |
|
58
|
|
|
} |
|
59
|
|
|
} |