SamlFactory::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 14
nc 1
nop 5
dl 0
loc 22
rs 9.7998
c 0
b 0
f 0
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\Security\Factory;
22
23
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface;
24
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
25
use Symfony\Component\DependencyInjection\ContainerBuilder;
26
use Symfony\Component\DependencyInjection\ChildDefinition;
27
28
class SamlFactory implements AuthenticatorFactoryInterface
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class SamlFactory
Loading history...
29
{
30
    public function create(ContainerBuilder $container, string $id, $config, $userProvider, $defaultEntryPoint): array
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function create()
Loading history...
31
    {
32
        $providerId = 'security.authentication.provider.saml.' . $id;
33
        $container->setDefinition(
34
            $providerId,
35
            new ChildDefinition('self_service.security.authentication.provider.saml')
36
        );
37
38
        $listenerId = 'security.authentication.listener.saml.' . $id;
39
        $container->setDefinition(
40
            $listenerId,
41
            new ChildDefinition('self_service.security.authentication.listener')
42
        );
43
44
        $cookieHandlerId = 'security.logout.handler.cookie_clearing.' . $id;
45
        $cookieHandler   = $container->setDefinition(
46
            $cookieHandlerId,
47
            new ChildDefinition('security.logout.handler.cookie_clearing')
48
        );
49
        $cookieHandler->addArgument([]);
50
51
        return [$providerId, $listenerId, $defaultEntryPoint];
52
    }
53
54
    public function getKey(): string
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function getKey()
Loading history...
55
    {
56
        return 'saml';
57
    }
58
59
    public function addConfiguration(NodeDefinition $builder): void
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function addConfiguration()
Loading history...
60
    {
61
    }
62
63
    public function getPriority(): int
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function getPriority()
Loading history...
64
    {
65
        return -10;
66
    }
67
68
    public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string|array
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function createAuthenticator()
Loading history...
69
    {
70
        return $config;
71
    }
72
}
73