Completed
Push — feature/pdp-cbac ( e99222 )
by
unknown
13:10
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 49
Code Lines 44

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 49
rs 9.2258
cc 1
eloc 44
nc 1
nop 0
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\StepupGateway\GatewayBundle\DependencyInjection;
20
21
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
22
use Symfony\Component\Config\Definition\ConfigurationInterface;
23
24
final class Configuration implements ConfigurationInterface
25
{
26
    public function getConfigTreeBuilder()
27
    {
28
        $treeBuilder = new TreeBuilder();
29
30
        $rootNode = $treeBuilder->root('surfnet_stepup_gateway_gateway');
31
32
        $children = $rootNode->children();
33
        $children
34
            ->scalarNode('intrinsic_loa')
35
                ->isRequired()
36
            ->end()
37
            ->arrayNode('enabled_second_factors')
38
                ->isRequired()
39
                ->prototype('scalar')
40
            ->end();
41
        $children
42
            ->arrayNode('enabled_generic_second_factors')
43
                ->isRequired()
44
                ->prototype('array')
45
                ->children()
46
                    ->scalarNode('loa')
47
                    ->isRequired()
48
                    ->info('The lao level of the Gssf')
49
                ->end()
50
            ->end();
51
        $children
52
            ->arrayNode('pdp')
53
            ->isRequired()
54
            ->children()
55
            ->scalarNode('url')
56
                ->isRequired()
57
                ->info('The full URL to the PDP endpoint')
58
                ->end()
59
            ->scalarNode('username')
60
                ->isRequired()
61
                ->info('The username for authentication on PDP')
62
                ->end()
63
            ->scalarNode('password')
64
                ->isRequired()
65
                ->info('The password for authentication on PDP')
66
                ->end()
67
            ->scalarNode('client_id')
68
                ->isRequired()
69
                ->info('The StepUp client ID for PDP')
70
                ->end()
71
            ->end();
72
73
        return $treeBuilder;
74
    }
75
}
76