@@ 5-36 (lines=32) @@ | ||
2 | ||
3 | namespace Surfnet\StepupGateway\GatewayBundle\Entity\SamlEntityRepository; |
|
4 | ||
5 | final class GatewaySamlEntityRepositoryDecorator implements SamlEntityRepositoryInterface |
|
6 | { |
|
7 | /** |
|
8 | * @var SamlEntityRepositoryInterface |
|
9 | */ |
|
10 | private $repository; |
|
11 | ||
12 | /** |
|
13 | * GatewaySamlEntityRepositoryDecorator constructor. |
|
14 | * @param SamlEntityRepositoryInterface $repository |
|
15 | */ |
|
16 | public function __construct(SamlEntityRepositoryInterface $repository) |
|
17 | { |
|
18 | $this->repository = $repository; |
|
19 | } |
|
20 | ||
21 | public function findIdentityProvider($entityId) |
|
22 | { |
|
23 | return $this->repository->findIdentityProvider($entityId); |
|
24 | } |
|
25 | ||
26 | public function findServiceProvider($entityId) |
|
27 | { |
|
28 | $serviceProvider = $this->repository->findServiceProvider($entityId); |
|
29 | ||
30 | if (!$serviceProvider->toServiceProvider()->mayUseGateway()) { |
|
31 | return null; |
|
32 | } |
|
33 | ||
34 | return $serviceProvider; |
|
35 | } |
|
36 | } |
|
37 |
@@ 7-39 (lines=33) @@ | ||
4 | ||
5 | use Surfnet\StepupGateway\GatewayBundle\Entity\SamlEntityRepository\SamlEntityRepositoryInterface; |
|
6 | ||
7 | final class SecondFactorOnlySamlEntityRepositoryDecorator |
|
8 | implements SamlEntityRepositoryInterface |
|
9 | { |
|
10 | /** |
|
11 | * @var SamlEntityRepositoryInterface |
|
12 | */ |
|
13 | private $repository; |
|
14 | ||
15 | /** |
|
16 | * SecondFactorOnlySamlEntityRepositoryDecorator constructor. |
|
17 | * @param SamlEntityRepositoryInterface $repository |
|
18 | */ |
|
19 | public function __construct(SamlEntityRepositoryInterface $repository) |
|
20 | { |
|
21 | $this->repository = $repository; |
|
22 | } |
|
23 | ||
24 | public function findIdentityProvider($entityId) |
|
25 | { |
|
26 | return $this->repository->findIdentityProvider($entityId); |
|
27 | } |
|
28 | ||
29 | public function findServiceProvider($entityId) |
|
30 | { |
|
31 | $serviceProvider = $this->repository->findServiceProvider($entityId); |
|
32 | ||
33 | if (!$serviceProvider->toServiceProvider()->mayUseSecondFactorOnly()) { |
|
34 | return null; |
|
35 | } |
|
36 | ||
37 | return $serviceProvider; |
|
38 | } |
|
39 | } |
|
40 |