|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* For the full copyright and license information, please view |
|
5
|
|
|
* the LICENSE file that was distributed with this source code. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
declare(strict_types=1); |
|
9
|
|
|
|
|
10
|
|
|
namespace EcPhp\ApiGwAuthenticationBundle\DependencyInjection; |
|
11
|
|
|
|
|
12
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
|
13
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
|
14
|
|
|
|
|
15
|
|
|
class Configuration implements ConfigurationInterface |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* {@inheritdoc} |
|
19
|
|
|
*/ |
|
20
|
1 |
|
public function getConfigTreeBuilder(): TreeBuilder |
|
21
|
|
|
{ |
|
22
|
1 |
|
$treeBuilder = new TreeBuilder('api_gw_authentication'); |
|
23
|
|
|
|
|
24
|
|
|
/** @var \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition $rootNode */ |
|
25
|
1 |
|
$rootNode = $treeBuilder->getRootNode(); |
|
26
|
|
|
|
|
27
|
|
|
/** @phpstan-ignore-next-line */ |
|
28
|
|
|
$rootNode |
|
29
|
1 |
|
->children() |
|
30
|
1 |
|
->arrayNode('defaults') |
|
31
|
1 |
|
->children() |
|
32
|
1 |
|
->enumNode('env') |
|
33
|
1 |
|
->values(['production', 'acceptance', 'intra', 'user']) |
|
34
|
1 |
|
->defaultValue('production') |
|
35
|
1 |
|
->isRequired() |
|
36
|
1 |
|
->cannotBeEmpty() |
|
37
|
1 |
|
->end() |
|
38
|
1 |
|
->end() |
|
|
|
|
|
|
39
|
1 |
|
->end() |
|
40
|
1 |
|
->arrayNode('envs') |
|
41
|
1 |
|
->defaultValue($this->getDefaultEnvs()) |
|
42
|
1 |
|
->useAttributeAsKey('name') |
|
43
|
1 |
|
->arrayPrototype() |
|
44
|
1 |
|
->children() |
|
45
|
1 |
|
->scalarNode('public')->end() |
|
46
|
1 |
|
->scalarNode('private')->defaultValue('')->end() |
|
47
|
1 |
|
->arrayNode('failsafe') |
|
48
|
1 |
|
->children() |
|
49
|
1 |
|
->scalarNode('public')->defaultValue('')->end() |
|
50
|
1 |
|
->scalarNode('private')->defaultValue('')->end() |
|
51
|
1 |
|
->end() |
|
52
|
1 |
|
->end() |
|
53
|
1 |
|
->end() |
|
54
|
1 |
|
->end() |
|
55
|
1 |
|
->end() |
|
56
|
1 |
|
->end(); |
|
57
|
|
|
|
|
58
|
1 |
|
return $treeBuilder; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
1 |
|
private function getDefaultEnvs(): array |
|
62
|
|
|
{ |
|
63
|
|
|
return [ |
|
64
|
|
|
'acceptance' => [ |
|
65
|
1 |
|
'public' => 'https://api.acceptance.tech.ec.europa.eu/federation/oauth/token/.well-known/jwks.json', |
|
66
|
|
|
'private' => null, |
|
67
|
|
|
'failsafe' => [ |
|
68
|
|
|
'public' => '', |
|
69
|
|
|
'private' => '', |
|
70
|
|
|
], |
|
71
|
|
|
], |
|
72
|
|
|
'production' => [ |
|
73
|
|
|
'public' => 'https://api.tech.ec.europa.eu/federation/oauth/token/.well-known/jwks.json', |
|
74
|
|
|
'private' => null, |
|
75
|
|
|
'failsafe' => [ |
|
76
|
|
|
'public' => '', |
|
77
|
|
|
'private' => '', |
|
78
|
|
|
], |
|
79
|
|
|
], |
|
80
|
|
|
'intra' => [ |
|
81
|
|
|
'public' => 'https://intrapi.tech.ec.europa.eu/federation/oauth/token/.well-known/jwks.json', |
|
82
|
|
|
'private' => null, |
|
83
|
|
|
'failsafe' => [ |
|
84
|
|
|
'public' => '', |
|
85
|
|
|
'private' => '', |
|
86
|
|
|
], |
|
87
|
|
|
], |
|
88
|
|
|
]; |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|