Passed
Pull Request — master (#56)
by Mark
01:55
created

HmacFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 37
ccs 0
cts 11
cp 0
rs 10
c 1
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getKey() 0 3 1
A addConfiguration() 0 2 1
A create() 0 9 1
A getPosition() 0 3 1
1
<?php
2
3
namespace Acquia\Hmac\Symfony;
4
5
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface;
6
use Symfony\Component\DependencyInjection\ChildDefinition;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
9
10
/**
11
 * Class HmacFactory
12
 *
13
 * Provides implementation of authentication provider and listener for Symfony.
14
 */
15
class HmacFactory implements SecurityFactoryInterface
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint)
21
    {
22
        $providerId = 'security.authentication.provider.hmac.' . $id;
23
        $container->setDefinition($providerId, new ChildDefinition('hmac.security.authentication.provider'));
24
25
        $listenerId = 'security.authentication.listener.hmac.' . $id;
26
        $container->setDefinition($listenerId, new ChildDefinition('hmac.security.authentication.listener'));
27
28
        return [$providerId, $listenerId, $defaultEntryPoint];
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function getPosition()
35
    {
36
        return 'pre_auth';
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function getKey()
43
    {
44
        return 'hmac_auth';
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function addConfiguration(NodeDefinition $node)
51
    {
52
    }
53
}
54