Passed
Push — master ( cd0cec...4b3abd )
by Alexandre
06:20
created

Server   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 29
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 25 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Alexandre
5
 * Date: 12/03/2018
6
 * Time: 21:26
7
 */
8
9
namespace OAuth2\Extensions\OpenID;
10
11
12
use Firebase\JWT\JWT;
13
use OAuth2\Config;
14
use OAuth2\Extensions\OpenID\Endpoints\AuthorizationEndpoint;
15
use OAuth2\Extensions\OpenID\Flows\AuthorizationCodeFlow;
16
use OAuth2\Extensions\OpenID\Flows\ImplicitFlow;
17
use OAuth2\Extensions\OpenID\Roles\ResourceOwnerInterface;
18
use OAuth2\Storages\StorageManager;
19
20
class Server extends \OAuth2\Server
21
{
22
    protected $idTokenManager;
23
24
    public function __construct(Config $config, StorageManager $storageManager, ResourceOwnerInterface $resourceOwner)
25
    {
26
        parent::__construct($config, $storageManager, $resourceOwner);
27
28
        $this->idTokenManager = new IdTokenManager(new JWT());
29
30
        $this->flowManager->addFlow(new AuthorizationCodeFlow(
31
            $storageManager->getAuthorizationCodeStorage(),
32
            $storageManager->getAccessTokenStorage(),
33
            $storageManager->getRefreshTokenStorage()
34
        ));
35
36
        $this->flowManager->addFlow(new ImplicitFlow(
37
            $this->idTokenManager,
38
            $storageManager->getAccessTokenStorage(),
39
            $storageManager->getRefreshTokenStorage()
40
        ));
41
42
        $this->authorizationEndpoint = new AuthorizationEndpoint(
43
            $this->responseTypeManager,
44
            $this->responseModeManager,
45
            $this->scopePolicyManager,
46
            $resourceOwner,
47
            $storageManager->getClientStorage(),
48
            $this->idTokenManager
49
        );
50
    }
51
}