1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types = 1); |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Copyright 2015 SURFnet bv |
7
|
|
|
* |
8
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
9
|
|
|
* you may not use this file except in compliance with the License. |
10
|
|
|
* You may obtain a copy of the License at |
11
|
|
|
* |
12
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
13
|
|
|
* |
14
|
|
|
* Unless required by applicable law or agreed to in writing, software |
15
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
16
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
17
|
|
|
* See the License for the specific language governing permissions and |
18
|
|
|
* limitations under the License. |
19
|
|
|
*/ |
|
|
|
|
20
|
|
|
|
21
|
|
|
namespace Surfnet\StepupSelfService\SamlStepupProviderBundle\DependencyInjection; |
22
|
|
|
|
23
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
24
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
25
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
26
|
|
|
|
27
|
|
|
class Configuration implements ConfigurationInterface |
|
|
|
|
28
|
|
|
{ |
29
|
|
|
public function getConfigTreeBuilder(): TreeBuilder |
|
|
|
|
30
|
|
|
{ |
31
|
|
|
$treeBuilder = new TreeBuilder('surfnet_stepup_self_service_saml_stepup_provider'); |
32
|
|
|
$rootNode = $treeBuilder->getRootNode(); |
33
|
|
|
|
34
|
|
|
$this->addRoutesSection($rootNode); |
35
|
|
|
$this->addProvidersSection($rootNode); |
36
|
|
|
|
37
|
|
|
return $treeBuilder; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
private function addRoutesSection(ArrayNodeDefinition $rootNode): void |
|
|
|
|
41
|
|
|
{ |
42
|
|
|
$rootNode |
43
|
|
|
->children() |
44
|
|
|
->arrayNode('routes') |
45
|
|
|
->children() |
|
|
|
|
46
|
|
|
->scalarNode('consume_assertion') |
|
|
|
|
47
|
|
|
->isRequired() |
|
|
|
|
48
|
|
|
->validate() |
|
|
|
|
49
|
|
|
->ifTrue(fn($v): bool => !is_string($v) || $v === '') |
|
|
|
|
50
|
|
|
->thenInvalid('Consume assertion route must be a non-empty string') |
|
|
|
|
51
|
|
|
->end() |
|
|
|
|
52
|
|
|
->end() |
|
|
|
|
53
|
|
|
->scalarNode('metadata') |
|
|
|
|
54
|
|
|
->isRequired() |
|
|
|
|
55
|
|
|
->validate() |
|
|
|
|
56
|
|
|
->ifTrue(fn($v): bool => !is_string($v) || $v === '') |
|
|
|
|
57
|
|
|
->thenInvalid('Metadata route must be a non-empty string') |
|
|
|
|
58
|
|
|
->end() |
|
|
|
|
59
|
|
|
->end() |
|
|
|
|
60
|
|
|
->end() |
|
|
|
|
61
|
|
|
->end(); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
|
|
|
|
65
|
|
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) |
66
|
|
|
*/ |
|
|
|
|
67
|
|
|
private function addProvidersSection(ArrayNodeDefinition $rootNode): void |
|
|
|
|
68
|
|
|
{ |
69
|
|
|
/** @var ArrayNodeDefinition $protoType */ |
|
|
|
|
70
|
|
|
$protoType = $rootNode |
71
|
|
|
->children() |
72
|
|
|
->arrayNode('providers') |
|
|
|
|
73
|
|
|
->isRequired() |
|
|
|
|
74
|
|
|
->requiresAtLeastOneElement() |
|
|
|
|
75
|
|
|
->useAttributeAsKey('type') |
|
|
|
|
76
|
|
|
->prototype('array'); |
|
|
|
|
77
|
|
|
|
78
|
|
|
$protoType |
79
|
|
|
->children() |
80
|
|
|
->arrayNode('hosted') |
|
|
|
|
81
|
|
|
->children() |
|
|
|
|
82
|
|
|
->arrayNode('service_provider') |
|
|
|
|
83
|
|
|
->children() |
|
|
|
|
84
|
|
|
->scalarNode('public_key') |
|
|
|
|
85
|
|
|
->isRequired() |
|
|
|
|
86
|
|
|
->info('The absolute path to the public key used to sign AuthnRequests') |
|
|
|
|
87
|
|
|
->end() |
|
|
|
|
88
|
|
|
->scalarNode('private_key') |
|
|
|
|
89
|
|
|
->isRequired() |
|
|
|
|
90
|
|
|
->info('The absolute path to the private key used to sign AuthnRequests') |
|
|
|
|
91
|
|
|
->end() |
|
|
|
|
92
|
|
|
->end() |
|
|
|
|
93
|
|
|
->end() |
|
|
|
|
94
|
|
|
->arrayNode('metadata') |
|
|
|
|
95
|
|
|
->children() |
|
|
|
|
96
|
|
|
->scalarNode('public_key') |
|
|
|
|
97
|
|
|
->isRequired() |
|
|
|
|
98
|
|
|
->info('The absolute path to the public key used to sign the metadata') |
|
|
|
|
99
|
|
|
->end() |
|
|
|
|
100
|
|
|
->scalarNode('private_key') |
|
|
|
|
101
|
|
|
->isRequired() |
|
|
|
|
102
|
|
|
->info('The absolute path to the private key used to sign the metadata') |
|
|
|
|
103
|
|
|
->end() |
|
|
|
|
104
|
|
|
->end() |
|
|
|
|
105
|
|
|
->end() |
|
|
|
|
106
|
|
|
->end() |
|
|
|
|
107
|
|
|
->end() |
|
|
|
|
108
|
|
|
->arrayNode('remote') |
|
|
|
|
109
|
|
|
->children() |
|
|
|
|
110
|
|
|
->scalarNode('entity_id') |
|
|
|
|
111
|
|
|
->isRequired() |
|
|
|
|
112
|
|
|
->info('The EntityID of the remote identity provider') |
|
|
|
|
113
|
|
|
->end() |
|
|
|
|
114
|
|
|
->scalarNode('sso_url') |
|
|
|
|
115
|
|
|
->isRequired() |
|
|
|
|
116
|
|
|
->info('The name of the route to generate the SSO URL') |
|
|
|
|
117
|
|
|
->end() |
|
|
|
|
118
|
|
|
->scalarNode('certificate') |
|
|
|
|
119
|
|
|
->isRequired() |
|
|
|
|
120
|
|
|
->info( |
|
|
|
|
121
|
|
|
'The contents of the certificate used to sign the AuthnResponse with, if different from' |
122
|
|
|
. ' the public key configured below' |
123
|
|
|
) |
124
|
|
|
->end() |
|
|
|
|
125
|
|
|
->end() |
|
|
|
|
126
|
|
|
->end() |
|
|
|
|
127
|
|
|
->arrayNode('view_config') |
|
|
|
|
128
|
|
|
->children() |
|
|
|
|
129
|
|
|
->scalarNode('loa') |
|
|
|
|
130
|
|
|
->isRequired() |
|
|
|
|
131
|
|
|
->info('The loa level (for now 1-3 are supported)') |
|
|
|
|
132
|
|
|
->end() |
|
|
|
|
133
|
|
|
->scalarNode('logo') |
|
|
|
|
134
|
|
|
->isRequired() |
|
|
|
|
135
|
|
|
->info('The absolute path to the logo of the gssp') |
|
|
|
|
136
|
|
|
->end() |
|
|
|
|
137
|
|
|
->scalarNode('app_android_url') |
|
|
|
|
138
|
|
|
->defaultFalse() |
|
|
|
|
139
|
|
|
->info('The optional Android app Play store URL') |
|
|
|
|
140
|
|
|
->end() |
|
|
|
|
141
|
|
|
->scalarNode('app_ios_url') |
|
|
|
|
142
|
|
|
->defaultFalse() |
|
|
|
|
143
|
|
|
->info('The optional iOs app Itunes store URL') |
|
|
|
|
144
|
|
|
->end() |
|
|
|
|
145
|
|
|
->arrayNode('alt') |
|
|
|
|
146
|
|
|
->children() |
|
|
|
|
147
|
|
|
->scalarNode('en_GB') |
|
|
|
|
148
|
|
|
->isRequired() |
|
|
|
|
149
|
|
|
->info('English alt text translation') |
|
|
|
|
150
|
|
|
->end() |
|
|
|
|
151
|
|
|
->scalarNode('nl_NL') |
|
|
|
|
152
|
|
|
->isRequired() |
|
|
|
|
153
|
|
|
->info('Dutch alt text translation') |
|
|
|
|
154
|
|
|
->end() |
|
|
|
|
155
|
|
|
->end() |
|
|
|
|
156
|
|
|
->end() |
|
|
|
|
157
|
|
|
->arrayNode('title') |
|
|
|
|
158
|
|
|
->children() |
|
|
|
|
159
|
|
|
->scalarNode('en_GB') |
|
|
|
|
160
|
|
|
->isRequired() |
|
|
|
|
161
|
|
|
->info('English title of the gssp') |
|
|
|
|
162
|
|
|
->end() |
|
|
|
|
163
|
|
|
->scalarNode('nl_NL') |
|
|
|
|
164
|
|
|
->isRequired() |
|
|
|
|
165
|
|
|
->info('Dutch title of the gssp') |
|
|
|
|
166
|
|
|
->end() |
|
|
|
|
167
|
|
|
->end() |
|
|
|
|
168
|
|
|
->end() |
|
|
|
|
169
|
|
|
->arrayNode('description') |
|
|
|
|
170
|
|
|
->children() |
|
|
|
|
171
|
|
|
->scalarNode('en_GB') |
|
|
|
|
172
|
|
|
->isRequired() |
|
|
|
|
173
|
|
|
->info('English description of the gssp') |
|
|
|
|
174
|
|
|
->end() |
|
|
|
|
175
|
|
|
->scalarNode('nl_NL') |
|
|
|
|
176
|
|
|
->isRequired() |
|
|
|
|
177
|
|
|
->info('Dutch description of the gssp') |
|
|
|
|
178
|
|
|
->end() |
|
|
|
|
179
|
|
|
->end() |
|
|
|
|
180
|
|
|
->end() |
|
|
|
|
181
|
|
|
->arrayNode('button_use') |
|
|
|
|
182
|
|
|
->children() |
|
|
|
|
183
|
|
|
->scalarNode('en_GB') |
|
|
|
|
184
|
|
|
->isRequired() |
|
|
|
|
185
|
|
|
->info('English text shown on the use button') |
|
|
|
|
186
|
|
|
->end() |
|
|
|
|
187
|
|
|
->scalarNode('nl_NL') |
|
|
|
|
188
|
|
|
->isRequired() |
|
|
|
|
189
|
|
|
->info('Dutch text shown on the use button') |
|
|
|
|
190
|
|
|
->end() |
|
|
|
|
191
|
|
|
->end() |
|
|
|
|
192
|
|
|
->end() |
|
|
|
|
193
|
|
|
->arrayNode('initiate_title') |
|
|
|
|
194
|
|
|
->children() |
|
|
|
|
195
|
|
|
->scalarNode('en_GB') |
|
|
|
|
196
|
|
|
->isRequired() |
|
|
|
|
197
|
|
|
->info('English initiate title text') |
|
|
|
|
198
|
|
|
->end() |
|
|
|
|
199
|
|
|
->scalarNode('nl_NL') |
|
|
|
|
200
|
|
|
->isRequired() |
|
|
|
|
201
|
|
|
->info('Dutch initiate title text') |
|
|
|
|
202
|
|
|
->end() |
|
|
|
|
203
|
|
|
->end() |
|
|
|
|
204
|
|
|
->end() |
|
|
|
|
205
|
|
|
->arrayNode('initiate_button') |
|
|
|
|
206
|
|
|
->children() |
|
|
|
|
207
|
|
|
->scalarNode('en_GB') |
|
|
|
|
208
|
|
|
->isRequired() |
|
|
|
|
209
|
|
|
->info('English initiate button text') |
|
|
|
|
210
|
|
|
->end() |
|
|
|
|
211
|
|
|
->scalarNode('nl_NL') |
|
|
|
|
212
|
|
|
->isRequired() |
|
|
|
|
213
|
|
|
->info('Dutch initiate button text') |
|
|
|
|
214
|
|
|
->end() |
|
|
|
|
215
|
|
|
->end() |
|
|
|
|
216
|
|
|
->end() |
|
|
|
|
217
|
|
|
->arrayNode('explanation') |
|
|
|
|
218
|
|
|
->children() |
|
|
|
|
219
|
|
|
->scalarNode('en_GB') |
|
|
|
|
220
|
|
|
->isRequired() |
|
|
|
|
221
|
|
|
->info('English explanation for step 2') |
|
|
|
|
222
|
|
|
->end() |
|
|
|
|
223
|
|
|
->scalarNode('nl_NL') |
|
|
|
|
224
|
|
|
->isRequired() |
|
|
|
|
225
|
|
|
->info('Dutch explanation for step 2') |
|
|
|
|
226
|
|
|
->end() |
|
|
|
|
227
|
|
|
->end() |
|
|
|
|
228
|
|
|
->end() |
|
|
|
|
229
|
|
|
->arrayNode('authn_failed') |
|
|
|
|
230
|
|
|
->children() |
|
|
|
|
231
|
|
|
->scalarNode('en_GB') |
|
|
|
|
232
|
|
|
->isRequired() |
|
|
|
|
233
|
|
|
->info('English text shown when authn request failed') |
|
|
|
|
234
|
|
|
->end() |
|
|
|
|
235
|
|
|
->scalarNode('nl_NL') |
|
|
|
|
236
|
|
|
->isRequired() |
|
|
|
|
237
|
|
|
->info('Dutch text shown when authn request failed') |
|
|
|
|
238
|
|
|
->end() |
|
|
|
|
239
|
|
|
->end() |
|
|
|
|
240
|
|
|
->end() |
|
|
|
|
241
|
|
|
->arrayNode('pop_failed') |
|
|
|
|
242
|
|
|
->children() |
|
|
|
|
243
|
|
|
->scalarNode('en_GB') |
|
|
|
|
244
|
|
|
->isRequired() |
|
|
|
|
245
|
|
|
->info('English text shown on failed proof of posession') |
|
|
|
|
246
|
|
|
->end() |
|
|
|
|
247
|
|
|
->scalarNode('nl_NL') |
|
|
|
|
248
|
|
|
->isRequired() |
|
|
|
|
249
|
|
|
->info('Dutch text shown on failed proof of posession') |
|
|
|
|
250
|
|
|
->end() |
|
|
|
|
251
|
|
|
->end() |
|
|
|
|
252
|
|
|
->end() |
|
|
|
|
253
|
|
|
->end() |
|
|
|
|
254
|
|
|
->end() |
|
|
|
|
255
|
|
|
->end(); |
256
|
|
|
} |
257
|
|
|
} |
258
|
|
|
|