WsseFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 15.38%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 4
dl 0
loc 48
ccs 2
cts 13
cp 0.1538
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 13 1
A getPosition() 0 4 1
A getKey() 0 4 1
A addConfiguration() 0 3 1
1
<?php
2
3
namespace Happyr\ApiBundle\DependencyInjection\Security\Factory;
4
5
use Symfony\Component\DependencyInjection\ChildDefinition;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
9
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface;
10
11
/**
12
 * Goes through the configuration and configures the WsseListener.
13
 *
14
 * @author Toby Ryuk
15
 */
16
class WsseFactory implements SecurityFactoryInterface
17
{
18
    /**
19
     * @param ContainerBuilder $container
20
     * @param int              $id
21
     * @param array            $config
22
     * @param string           $userProvider
23
     * @param string           $defaultEntryPoint
24
     *
25
     * @return array
26
     */
27
    public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint)
28
    {
29
        $providerId = 'security.authentication.provider.wsse.'.$id;
30
        $container
31
            ->setDefinition($providerId, new ChildDefinition('happyr_api.wsse.security.authentication.provider'))
32
            ->replaceArgument(0, new Reference($userProvider))
33
        ;
34
35
        $listenerId = 'security.authentication.listener.wsse.'.$id;
36
        $container->setDefinition($listenerId, new ChildDefinition('happyr_api.wsse.security.authentication.listener'));
37
38
        return [$providerId, $listenerId, $defaultEntryPoint];
39
    }
40
41
    /**
42
     * @return string
43
     */
44 1
    public function getPosition()
45
    {
46 1
        return 'pre_auth';
47
    }
48
49
    /**
50
     * @return string
51
     */
52
    public function getKey()
53
    {
54
        return 'wsse';
55
    }
56
57
    /**
58
     * @param NodeDefinition $node
59
     */
60
    public function addConfiguration(NodeDefinition $node)
61
    {
62
    }
63
}
64