1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2014 SURFnet bv |
5
|
|
|
* |
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
7
|
|
|
* you may not use this file except in compliance with the License. |
8
|
|
|
* You may obtain a copy of the License at |
9
|
|
|
* |
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
* |
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15
|
|
|
* See the License for the specific language governing permissions and |
16
|
|
|
* limitations under the License. |
17
|
|
|
*/ |
|
|
|
|
18
|
|
|
|
19
|
|
|
namespace Surfnet\StepupMiddleware\CommandHandlingBundle\DependencyInjection; |
20
|
|
|
|
21
|
|
|
use Symfony\Component\Config\Definition\Processor; |
22
|
|
|
use Symfony\Component\Config\FileLocator; |
23
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
24
|
|
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
25
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
26
|
|
|
|
27
|
|
|
class SurfnetStepupMiddlewareCommandHandlingExtension extends Extension |
|
|
|
|
28
|
|
|
{ |
29
|
|
|
public function load(array $config, ContainerBuilder $container): void |
30
|
|
|
{ |
31
|
|
|
$loader = new YamlFileLoader( |
32
|
|
|
$container, |
33
|
|
|
new FileLocator(__DIR__ . '/../Resources/config'), |
34
|
|
|
); |
35
|
|
|
$loader->load('command_handlers.yml'); |
36
|
|
|
$loader->load('event_sourcing.yml'); |
37
|
|
|
$loader->load('pipeline.yml'); |
38
|
|
|
$loader->load('processors.yml'); |
39
|
|
|
|
40
|
|
|
$processor = new Processor(); |
41
|
|
|
$config = $processor->processConfiguration(new Configuration(), $config); |
42
|
|
|
|
43
|
|
|
$container |
44
|
|
|
->getDefinition('surfnet_stepup_middleware_command_handling.email_sender') |
45
|
|
|
->replaceArgument(0, $config['email_sender']['name']) |
46
|
|
|
->replaceArgument(1, $config['email_sender']['email']); |
47
|
|
|
|
48
|
|
|
$container |
49
|
|
|
->getDefinition('surfnet_stepup_middleware_command_handling.service.email_verification_mail') |
50
|
|
|
->replaceArgument(3, $config['self_service_email_verification_url_template']) |
51
|
|
|
->replaceArgument(5, $config['email_fallback_locale']) |
52
|
|
|
->replaceArgument(6, $config['self_service_url']); |
53
|
|
|
|
54
|
|
|
$container |
55
|
|
|
->getDefinition('surfnet_stepup_middleware_command_handling.service.registration_mail') |
56
|
|
|
->replaceArgument(4, $config['email_fallback_locale']) |
57
|
|
|
->replaceArgument(5, $config['self_service_url']); |
58
|
|
|
|
59
|
|
|
$container |
60
|
|
|
->getDefinition('surfnet_stepup_middleware_command_handling.service.second_factor_revocation_mail') |
61
|
|
|
->replaceArgument(4, $config['email_fallback_locale']) |
62
|
|
|
->replaceArgument(5, $config['self_service_url']); |
63
|
|
|
|
64
|
|
|
$container |
65
|
|
|
->getDefinition('surfnet_stepup_middleware_command_handling.service.second_factor_vetted_mail') |
66
|
|
|
->replaceArgument(4, $config['email_fallback_locale']) |
67
|
|
|
->replaceArgument(5, $config['self_service_url']); |
68
|
|
|
|
69
|
|
|
$container |
70
|
|
|
->getDefinition('surfnet_stepup_middleware_command_handling.service.recovery_token_mail') |
71
|
|
|
->replaceArgument(4, $config['email_fallback_locale']) |
72
|
|
|
->replaceArgument(5, $config['self_service_url']); |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|