Failed Conditions
Push — master ( 349866...67c1d1 )
by Florent
10:56 queued 06:08
created

OAuth2Token::getClientId()   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
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2018 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace OAuth2Framework\SecurityBundle\Security\Authentication\Token;
15
16
use OAuth2Framework\Component\Core\AccessToken\AccessToken;
17
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
18
19
class OAuth2Token extends AbstractToken
20
{
21
    /**
22
     * @var AccessToken
23
     */
24
    private $accessToken;
25
26
    public function __construct(AccessToken $accessToken)
27
    {
28
        parent::__construct();
29
        $this->accessToken = $accessToken;
30
    }
31
32
    /**
33
     * @return string
34
     */
35
    public function getToken(): string
36
    {
37
        return $this->accessToken->getTokenId()->getValue();
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function getTokenType(): string
44
    {
45
        return $this->accessToken->getParameter('token_type');
46
    }
47
48
    /**
49
     * @return AccessToken
50
     */
51
    public function getAccessToken(): AccessToken
52
    {
53
        return $this->accessToken;
54
    }
55
56
    /**
57
     * @return string
58
     */
59
    public function getClientId(): string
60
    {
61
        return $this->accessToken->getClientId()->getValue();
62
    }
63
64
    /**
65
     * @return string
66
     */
67
    public function getResourceOwnerId(): string
68
    {
69
        return $this->accessToken->getResourceOwnerId()->getValue();
70
    }
71
72
    /**
73
     * {@inheritdoc}
74
     */
75
    public function getCredentials()
76
    {
77
        return $this->getToken();
78
    }
79
}
80