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

JwtAuthenticatedToken::getCredentials()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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
}