DebugProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 37
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setDebugRoles() 0 6 1
A authenticate() 0 6 1
A supports() 0 4 1
1
<?php
2
3
namespace Happyr\ApiBundle\Security\Authentication\Provider;
4
5
use Happyr\ApiBundle\Security\Authentication\Token\WsseUserToken;
6
use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface;
7
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
8
9
/**
10
 * Debug provider is always open. No security here.
11
 *
12
 * @author Tobias Nyholm <[email protected]>
13
 */
14
class DebugProvider implements AuthenticationProviderInterface
15
{
16
    /**
17
     * @var array
18
     */
19
    private $debugRoles;
20
21
    /**
22
     * @param array $debugRoles
23
     *
24
     * @return DebugProvider
25
     */
26
    public function setDebugRoles($debugRoles)
27
    {
28
        $this->debugRoles = $debugRoles;
29
30
        return $this;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function authenticate(TokenInterface $token)
37
    {
38
        $authenticatedToken = new WsseUserToken($this->debugRoles);
39
40
        return $authenticatedToken;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function supports(TokenInterface $token)
47
    {
48
        return true;
49
    }
50
}
51