Failed Conditions
Push — master ( 516359...a8b39a )
by Florent
04:00
created

DistributedClaimSource   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 19
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2017 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\Tests\Stub;
15
16
use OAuth2Framework\Component\Server\Endpoint\UserInfo\ClaimSource\ClaimSourceInterface;
17
use OAuth2Framework\Component\Server\Endpoint\UserInfo\ClaimSource\Source;
18
use OAuth2Framework\Component\Server\Model\UserAccount\UserAccountInterface;
19
20
final class DistributedClaimSource implements ClaimSourceInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function getUserInfo(UserAccountInterface $userAccount, array $scope, array $claims)
26
    {
27
        if ('user2' === $userAccount->getPublicId()->getValue()) {
28
            $claims = ['address', 'email', 'email_verified'];
29
            $source = [
30
                'endpoint' => 'https://external.service.local/user/info',
31
                'access_token' => '0123456789',
32
                'token_type' => 'Bearer',
33
            ];
34
35
            return new Source($claims, $source);
36
        }
37
    }
38
}
39