JWTUserToken::setRawToken()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace ApiBundle\Security\Authentication\Token;
4
5
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
6
7
class JWTUserToken extends AbstractToken
8
{
9
    const KEY_TYPE = OPENSSL_KEYTYPE_RSA;
10
    const ALGO = OPENSSL_ALGO_SHA256;
11
12
    /**
13
     * @var string
14
     */
15
    protected $rawToken;
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function __construct(array $roles = [])
21
    {
22
        parent::__construct($roles);
23
        $this->setAuthenticated(count($roles) > 0);
24
    }
25
26
    /**
27
     * @param string $rawToken
28
     */
29
    public function setRawToken($rawToken)
30
    {
31
        $this->rawToken = $rawToken;
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function getCredentials()
38
    {
39
        return $this->rawToken;
40
    }
41
}
42