RemoteUserFactory   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 48
c 0
b 0
f 0
wmc 5
lcom 0
cbo 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 16 1
A getListenerId() 0 4 1
A getPosition() 0 4 1
A getKey() 0 4 1
A addConfiguration() 0 7 1
1
<?php
2
3
namespace Kaliop\IdentityManagementBundle\Security\Factory;
4
5
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\FormLoginFactory;
6
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface;
7
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\DependencyInjection\DefinitionDecorator;
10
use Symfony\Component\DependencyInjection\Reference;
11
12
/**
13
 * @see http://www.caillarec-coste.fr/symfony2-introduire-une-logique-personnalise-durant-le-login/
14
 */
15
class RemoteUserFactory extends FormLoginFactory //implements SecurityFactoryInterface
16
{
17
    public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint)
18
    {
19
        $providerId = 'security.authentication.provider.remoteuser.'.$id;
20
        $container
21
            ->setDefinition($providerId, new DefinitionDecorator('kaliop_identity.security.authentication.provider.remoteuser'))
22
            ->replaceArgument(0, new Reference($config['client']))
23
            ->replaceArgument(1, new Reference($userProvider))
24
            ->replaceArgument(2, $id)
25
        ;
26
27
        //$listenerId = 'security.authentication.listener.ams.'.$id;
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
28
        //$container->setDefinition($listenerId, new DefinitionDecorator('kaliop_identity.security.authentication.listener.remoteuser'));
0 ignored issues
show
Unused Code Comprehensibility introduced by
74% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
29
        $listenerId = $this->createListener($container, $id, $config, $userProvider);
30
31
        return array($providerId, $listenerId, $defaultEntryPoint);
32
    }
33
34
    protected function getListenerId()
35
    {
36
        return 'kaliop_identity.security.authentication.listener.remoteuser';
37
    }
38
39
    /**
40
     * Defines the position at which the provider is called.
41
     * Possible values: pre_auth, form, http, and remember_me.
42
     *
43
     * @return string
44
     */
45
    public function getPosition()
46
    {
47
        return 'form';
48
    }
49
50
    public function getKey()
51
    {
52
        return 'remoteuser_login';
53
    }
54
55
    public function addConfiguration(NodeDefinition $node)
56
    {
57
        $node
58
            ->children()
59
            ->scalarNode('client')
60
            ->end();
61
    }
62
}