Implicit::verifyRequest()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 2
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace kalanis\OAuth2\Grant;
4
5
6
use kalanis\OAuth2\Storage\AccessTokens\IAccessToken;
7
use kalanis\OAuth2\Storage\Clients\IClient;
8
use kalanis\OAuth2\Storage\ITokenFacade;
9
10
11
/**
12
 * Implicit grant type
13
 * @package kalanis\OAuth2\Grant
14
 */
15
class Implicit extends GrantType
16
{
17
18
    /**
19
     * Get identifier string to this grant type
20
     */
21
    public function getIdentifier(): string
22
    {
23
        return self::IMPLICIT;
24
    }
25
26
    /**
27
     * Verify grant type
28
     */
29
    protected function verifyGrantType(IClient $client): void
30
    {
31
    }
32
33
    /**
34
     * Verify request
35
     * @return void
36
     */
37
    protected function verifyRequest(): void
38
    {
39
    }
40
41
    /**
42
     * Generate access token
43
     * @param IClient $client
44
     * @return array<string, string|int>
45
     */
46
    protected function generateAccessToken(IClient $client): array
47
    {
48 1
        $accessTokenStorage = $this->token->getToken(ITokenFacade::ACCESS_TOKEN);
49
        /** @var IAccessToken $accessToken */
50 1
        $accessToken = $accessTokenStorage->create($client, $this->user->getId(), $this->getScope());
51
52
        return [
53 1
            'access_token' => $accessToken->getAccessToken(),
54 1
            'expires_in' => $accessTokenStorage->getLifetime(),
55 1
            'token_type' => 'bearer'
56
        ];
57
    }
58
}
59