Failed Conditions
Push — ng ( 68a719...06acb0 )
by Florent
23:02
created

None::checkClientConfiguration()   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
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
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\Component\Server\TokenEndpoint\AuthenticationMethod;
15
16
use OAuth2Framework\Component\Server\Core\Client\Client;
17
use OAuth2Framework\Component\Server\Core\Client\ClientId;
18
use OAuth2Framework\Component\Server\Core\DataBag\DataBag;
19
use Psr\Http\Message\ServerRequestInterface;
20
21
final class None implements AuthenticationMethod
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function getSchemesParameters(): array
27
    {
28
        return [];
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function findClientIdAndCredentials(ServerRequestInterface $request, &$clientCredentials = null): ? ClientId
35
    {
36
        $parameters = $request->getParsedBody() ?? [];
37
        if (array_key_exists('client_id', $parameters)) {
38
            return ClientId::create($parameters['client_id']);
39
        }
40
41
        return null;
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function checkClientConfiguration(DataBag $command_parameters, DataBag $validated_parameters): DataBag
48
    {
49
        return $validated_parameters;
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function isClientAuthenticated(Client $client, $clientCredentials, ServerRequestInterface $request): bool
56
    {
57
        return true;
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function getSupportedMethods(): array
64
    {
65
        return ['none'];
66
    }
67
}
68