UserToken::getCredentials()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the TheAlternativeZurich/events project.
5
 *
6
 * (c) Florian Moser <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace App\Security;
13
14
use App\Entity\User;
15
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
16
17
class UserToken extends AbstractToken
18
{
19
    public function __construct(User $user)
20
    {
21
        parent::__construct($user->getRoles());
22
23
        $this->setUser($user->getEmail());
24
        $this->setAuthenticated(true);
25
    }
26
27
    /**
28
     * This is meant to be only an authenticated token, where credentials
29
     * have already been used and are thus cleared.
30
     *
31
     * {@inheritdoc}
32
     */
33
    public function getCredentials()
34
    {
35
        return [];
36
    }
37
}
38