Completed
Push — master ( ff92f6...3ef1d3 )
by John
09:08
created

JwtAuthenticatedToken   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getCredentials() 0 4 1
1
<?php declare(strict_types = 1);
2
/*
3
 * This file is part of the KleijnWeb\JwtBundle package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace KleijnWeb\JwtBundle\Authentication;
10
11
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
12
use Symfony\Component\Security\Core\User\UserInterface;
13
14
class JwtAuthenticatedToken extends AbstractToken
15
{
16
    /**
17
     * @param UserInterface $user
18
     */
19
    public function __construct(UserInterface $user)
20
    {
21
        parent::__construct($user->getRoles());
22
23
        $this->setAuthenticated(count($this->getRoles()) > 0);
24
25
        $this->setUser($user);
26
    }
27
28
    /**
29
     * Always returns empty string
30
     *
31
     * @return string
32
     */
33
    public function getCredentials()
34
    {
35
        return '';
36
    }
37
}