ResponseVerifierBuilder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
dl 0
loc 34
ccs 0
cts 15
cp 0
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 12 1
A setClockTolerance() 0 5 1
A setAadIssValidation() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Facile\OpenIDClient\Token;
6
7
use Facile\JoseVerifier\AuthorizationResponseVerifierBuilder;
8
use Facile\OpenIDClient\Client\ClientInterface;
9
10
final class ResponseVerifierBuilder implements TokenVerifierBuilderInterface
11
{
12
    /** @var bool */
13
    private $aadIssValidation = false;
14
15
    /** @var int */
16
    private $clockTolerance = 0;
17
18
    public function setAadIssValidation(bool $aadIssValidation): self
19
    {
20
        $this->aadIssValidation = $aadIssValidation;
21
22
        return $this;
23
    }
24
25
    public function setClockTolerance(int $clockTolerance): self
26
    {
27
        $this->clockTolerance = $clockTolerance;
28
29
        return $this;
30
    }
31
32
    public function build(ClientInterface $client): \Facile\JoseVerifier\TokenVerifierInterface
33
    {
34
        $builder = new AuthorizationResponseVerifierBuilder();
35
36
        $builder->setJwksProvider($client->getIssuer()->getJwksProvider());
37
        $builder->setClientMetadata($client->getMetadata()->toArray());
38
        $builder->setClientJwksProvider($client->getJwksProvider());
39
        $builder->setIssuerMetadata($client->getIssuer()->getMetadata()->toArray());
40
        $builder->setClockTolerance($this->clockTolerance);
41
        $builder->setAadIssValidation($this->aadIssValidation);
42
43
        return $builder->build();
44
    }
45
}
46