Configuration   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 131
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 106
dl 0
loc 131
rs 10
c 2
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A appendEnabledSecondFactorTypesConfiguration() 0 17 1
A appendSecondFactorTestIdentityProvider() 0 22 1
A appendSessionConfiguration() 0 35 1
A getConfigTreeBuilder() 0 12 1
A appendActivationFlow() 0 35 1
1
<?php
2
3
declare(strict_types = 1);
4
5
/**
6
 * Copyright 2014 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
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
Coding Style introduced by
Missing @link tag in file comment
Loading history...
20
21
namespace Surfnet\StepupSelfService\SelfServiceBundle\DependencyInjection;
22
23
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
24
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
25
use Symfony\Component\Config\Definition\ConfigurationInterface;
26
27
class Configuration implements ConfigurationInterface
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class Configuration
Loading history...
28
{
29
    public function getConfigTreeBuilder(): TreeBuilder
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function getConfigTreeBuilder()
Loading history...
30
    {
31
        $treeBuilder = new TreeBuilder('surfnet_stepup_self_service_self_service');
32
        $rootNode = $treeBuilder->getRootNode();
33
34
        $childNodes = $rootNode->children();
35
        $this->appendEnabledSecondFactorTypesConfiguration($childNodes);
36
        $this->appendSecondFactorTestIdentityProvider($childNodes);
37
        $this->appendSessionConfiguration($childNodes);
38
        $this->appendActivationFlow($childNodes);
39
40
        return $treeBuilder;
41
    }
42
43
    private function appendSessionConfiguration(NodeBuilder $childNodes): void
0 ignored issues
show
Coding Style introduced by
Private method name "Configuration::appendSessionConfiguration" must be prefixed with an underscore
Loading history...
Coding Style introduced by
Missing doc comment for function appendSessionConfiguration()
Loading history...
44
    {
45
        $childNodes
46
            ->arrayNode('session_lifetimes')
47
                ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
48
                ->children()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
49
                    ->integerNode('max_absolute_lifetime')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
50
                        ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
51
                        ->defaultValue(3600)
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
52
                        ->info('The maximum lifetime of a session regardless of interaction by the user, in seconds.')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
53
                        ->example('3600 -> 1 hour * 60 minutes * 60 seconds')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
54
                        ->validate()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
55
                            ->ifTrue(
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 28
Loading history...
56
                                fn($lifetime): bool => !is_int($lifetime)
57
                            )
58
                            ->thenInvalid('max_absolute_lifetime must be an integer')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 28
Loading history...
59
                        ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
60
                    ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
61
                    ->integerNode('max_relative_lifetime')
0 ignored issues
show
Bug introduced by
The method integerNode() does not exist on Symfony\Component\Config...der\NodeParentInterface. It seems like you code against a sub-type of Symfony\Component\Config...der\NodeParentInterface such as Symfony\Component\Config...ion\Builder\NodeBuilder. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

61
                    ->/** @scrutinizer ignore-call */ integerNode('max_relative_lifetime')
Loading history...
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
62
                        ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
63
                        ->defaultValue(600)
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
64
                        ->info(
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
65
                            'The maximum relative lifetime of a session; the maximum allowed time between two '
66
                            . 'interactions by the user'
67
                        )
68
                        ->example('600 -> 10 minutes * 60 seconds')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
69
                        ->validate()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
70
                            ->ifTrue(
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 28
Loading history...
71
                                fn($lifetime): bool => !is_int($lifetime)
72
                            )
73
                            ->thenInvalid('max_relative_lifetime must be an integer')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 28
Loading history...
74
                        ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
75
                    ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
76
                ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
77
            ->end();
78
    }
79
80
    private function appendSecondFactorTestIdentityProvider(NodeBuilder $childNodes): void
0 ignored issues
show
Coding Style introduced by
Private method name "Configuration::appendSecondFactorTestIdentityProvider" must be prefixed with an underscore
Loading history...
Coding Style introduced by
Missing doc comment for function appendSecondFactorTestIdentityProvider()
Loading history...
81
    {
82
        $childNodes
83
            ->arrayNode('second_factor_test_identity_provider')
84
                ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
85
                ->children()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
86
                    ->scalarNode('entity_id')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
87
                        ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
88
                        ->info('The EntityID of the remote identity provider')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
89
                    ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
90
                    ->scalarNode('sso_url')
0 ignored issues
show
Bug introduced by
The method scalarNode() does not exist on Symfony\Component\Config...der\NodeParentInterface. It seems like you code against a sub-type of Symfony\Component\Config...der\NodeParentInterface such as Symfony\Component\Config...ion\Builder\NodeBuilder. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

90
                    ->/** @scrutinizer ignore-call */ scalarNode('sso_url')
Loading history...
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
91
                        ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
92
                        ->info('The name of the route to generate the SSO URL')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
93
                    ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
94
                    ->scalarNode('certificate')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
95
                        ->info('The contents of the certificate used to sign the AuthnResponse with')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
96
                    ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
97
                    ->scalarNode('certificate_file')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
98
                        ->info('A file containing the certificate used to sign the AuthnResponse with')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
99
                    ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
100
                ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
101
            ->end();
102
    }
103
104
    private function appendEnabledSecondFactorTypesConfiguration(NodeBuilder $childNodes): void
0 ignored issues
show
Coding Style introduced by
Private method name "Configuration::appendEnabledSecondFactorTypesConfiguration" must be prefixed with an underscore
Loading history...
Coding Style introduced by
Missing doc comment for function appendEnabledSecondFactorTypesConfiguration()
Loading history...
105
    {
106
        $childNodes
107
            ->arrayNode('enabled_second_factors')
108
                ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
109
                ->prototype('scalar')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
110
            ->end();
111
        $childNodes
112
            ->arrayNode('enabled_generic_second_factors')
113
                ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
114
                ->prototype('array')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
115
                ->children()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
116
                    ->scalarNode('loa')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
117
                    ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
118
                    ->info('The LOA level of the Gssp')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
119
                ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
120
            ->end();
121
    }
122
123
    private function appendActivationFlow(NodeBuilder $childNodes): void
0 ignored issues
show
Coding Style introduced by
Private method name "Configuration::appendActivationFlow" must be prefixed with an underscore
Loading history...
Coding Style introduced by
Missing doc comment for function appendActivationFlow()
Loading history...
124
    {
125
        $childNodes
126
            ->arrayNode('preferred_activation_flow')
127
            ->isRequired()
128
                ->children()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
129
                    ->scalarNode('query_string_field_name')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
130
                        ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
131
                        ->info('The name of the query string field that triggers the preferred activation flow')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
132
                    ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
133
                    ->arrayNode('options')
0 ignored issues
show
Bug introduced by
The method arrayNode() does not exist on Symfony\Component\Config...der\NodeParentInterface. It seems like you code against a sub-type of Symfony\Component\Config...der\NodeParentInterface such as Symfony\Component\Config...ion\Builder\NodeBuilder. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

133
                    ->/** @scrutinizer ignore-call */ arrayNode('options')
Loading history...
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
134
                        ->prototype('scalar')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
135
                            ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 28
Loading history...
136
                            ->info('The options describing the preferred activation flow. Example: ra, self')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 28
Loading history...
137
                        ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
138
                    ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
139
                    ->scalarNode('saml_attribute_field_name')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
140
                        ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
141
                        ->info('The name of the entitlement attribute (in SAML assertion) that is read to determine the preferred activation flow')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
142
                    ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
143
                    ->arrayNode('saml_attributes')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
144
                        ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
145
                        ->children()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
146
                            ->scalarNode('ra')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 28
Loading history...
147
                                ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 32
Loading history...
148
                                ->info('The entitlement attribute name for the ra vetting flow')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 32
Loading history...
149
                            ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 28
Loading history...
150
                            ->scalarNode('self')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 28
Loading history...
151
                                ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 32
Loading history...
152
                                ->info('The entitlement attribute name for the self vetting flow')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 32
Loading history...
153
                            ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 28
Loading history...
154
                        ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
155
                    ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
156
157
            ->end()
0 ignored issues
show
Coding Style introduced by
Space after closing parenthesis of function call prohibited
Loading history...
158
        ;
159
    }
160
}
161