Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 45
Code Lines 40

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 40
nc 1
nop 0
dl 0
loc 45
rs 9.28
c 1
b 0
f 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('surfnet_stepup_gateway_gateway');
29
30
        $rootNode = $treeBuilder->getRootNode();
31
32
        $children = $rootNode->children();
33
        $children
34
            ->scalarNode('intrinsic_loa')
35
                ->isRequired()
36
            ->end()
37
            ->arrayNode('sso_on_second_factor')
38
                ->isRequired()
39
                ->children()
40
                    ->enumNode('cookie_type')
41
                        ->values(['session', 'persistent'])
42
                        ->isRequired()
43
                    ->end()
44
                    ->scalarNode('cookie_name')
45
                        ->isRequired()
46
                    ->end()
47
                    ->integerNode('cookie_lifetime')
48
                        ->isRequired()
49
                    ->end()
50
                    ->scalarNode('encryption_key')
51
                        ->isRequired()
52
                    ->end()
53
                ->end()
54
            ->end()
55
            ->arrayNode('enabled_second_factors')
56
                ->isRequired()
57
                ->prototype('scalar')
58
            ->end();
59
        $children
60
            ->arrayNode('enabled_generic_second_factors')
61
                ->isRequired()
62
                ->prototype('array')
63
                ->children()
64
                    ->scalarNode('loa')
65
                    ->isRequired()
66
                    ->info('The lao level of the Gssf')
67
                ->end()
68
            ->end();
69
70
        return $treeBuilder;
71
    }
72
}
73