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

AbstractJwtAwareRefreshToken   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 4
dl 0
loc 23
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A convertToEncryptedRefreshToken() 0 15 1
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