Completed
Push — master ( b97427...e235cc )
by Raffael
30:35 queued 26:08
created

Installation   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 38
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A start() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * balloon
7
 *
8
 * @copyright   Copryright (c) 2012-2019 gyselroth GmbH (https://gyselroth.com)
9
 * @license     GPL-3.0 https://opensource.org/licenses/GPL-3.0
10
 */
11
12
namespace Balloon\App\Webauthn\Migration\Delta;
13
14
use Balloon\App\Idp\Storage\Db as OAuth2Storage;
15
use Balloon\Migration\Delta\DeltaInterface;
16
use MongoDB\Database;
17
18
class Installation implements DeltaInterface
19
{
20
    /**
21
     * MongoDB.
22
     *
23
     * @var Database
24
     */
25
    protected $db;
26
27
    /**
28
     * OAuth2 storage.
29
     *
30
     * @var OAuth2Storage
31
     */
32
    protected $storage;
33
34
    /**
35
     * Construct.
36
     */
37
    public function __construct(OAuth2Storage $storage, Database $db)
38
    {
39
        $this->storage = $storage;
40
        $this->db = $db;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function start(): bool
47
    {
48
        $this->storage->setClientDetails('balloon-client-web', null, null, 'password refresh_token password_mfa webauthn webauthn_mfa');
49
        $this->storage->setClientDetails('balloon-client-desktop', null, null, 'password refresh_token password_mfa webauthn webauthn_mfa');
50
        $this->db->creation_challenges->createIndex(['created' => 1], ['expireAfterSeconds' => 60]);
51
        $this->db->request_challenges->createIndex(['created' => 1], ['expireAfterSeconds' => 60]);
52
53
        return true;
54
    }
55
}
56