Completed
Pull Request — master (#823)
by Martin
32:46
created

convertToEncryptedRefreshToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
/**
3
 * @author      Alex Bilbie <[email protected]>
4
 * @copyright   Copyright (c) Alex Bilbie
5
 * @license     http://mit-license.org/
6
 *
7
 * @link        https://github.com/thephpleague/oauth2-server
8
 */
9
10
namespace League\OAuth2\Server\Entities;
11
12
use League\OAuth2\Server\CryptTrait;
13
use League\OAuth2\Server\Entities\Traits\RefreshTokenTrait;
14
15
abstract class AbstractJwtAwareRefreshToken implements RefreshTokenEntityInterface {
16
17
    use RefreshTokenTrait, CryptTrait;
18
19
    /**
20
     * @inheritdoc
21
     */
22
    public function convertToEncryptedRefreshToken()
23
    {
24
        return $this->encrypt(
25
            json_encode(
26
                [
27
                    'client_id'        => $this->accessToken->getClient()->getIdentifier(),
28
                    'refresh_token_id' => $this->getIdentifier(),
29
                    'access_token_id'  => $this->accessToken->getIdentifier(),
30
                    'scopes'           => $this->accessToken->getScopes(),
31
                    'user_id'          => $this->accessToken->getUserIdentifier(),
32
                    'expire_time'      => $this->getExpiryDateTime()->getTimestamp(),
33
                ]
34
            )
35
        );
36
    }
37
}
38