|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Copyright 2025 SURFnet bv |
|
7
|
|
|
* |
|
8
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
9
|
|
|
* you may not use this file except in compliance with the License. |
|
10
|
|
|
* You may obtain a copy of the License at |
|
11
|
|
|
* |
|
12
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
13
|
|
|
* |
|
14
|
|
|
* Unless required by applicable law or agreed to in writing, software |
|
15
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
16
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
17
|
|
|
* See the License for the specific language governing permissions and |
|
18
|
|
|
* limitations under the License. |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace Surfnet\StepupGateway\Behat\Mock; |
|
22
|
|
|
|
|
23
|
|
|
use Surfnet\StepupBundle\Service\SecondFactorTypeService; |
|
24
|
|
|
use Surfnet\StepupBundle\Value\Loa; |
|
25
|
|
|
use Surfnet\StepupGateway\GatewayBundle\Service\SecondFactor\SecondFactorInterface; |
|
26
|
|
|
|
|
27
|
|
|
readonly class MockSecondFactor implements SecondFactorInterface |
|
28
|
|
|
{ |
|
29
|
|
|
public function __construct( |
|
30
|
|
|
public string $id, |
|
31
|
|
|
public string $identityId, |
|
32
|
|
|
public string $nameId, |
|
33
|
|
|
public string $institution, |
|
34
|
|
|
public string $displayLocale, |
|
35
|
|
|
public string $secondFactorId, |
|
36
|
|
|
public string $secondFactorType, |
|
37
|
|
|
public string $secondFactorIdentifier, |
|
38
|
|
|
public bool $identityVetted = true, |
|
39
|
|
|
) { |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
|
|
43
|
|
|
public function canSatisfy(Loa $loa, SecondFactorTypeService $service): bool |
|
|
|
|
|
|
44
|
|
|
{ |
|
45
|
|
|
return true; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function getLoaLevel(SecondFactorTypeService $service): float |
|
|
|
|
|
|
49
|
|
|
{ |
|
50
|
|
|
return 2.0; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function getSecondFactorId(): string |
|
54
|
|
|
{ |
|
55
|
|
|
return $this->secondFactorId; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function getSecondFactorType(): string |
|
59
|
|
|
{ |
|
60
|
|
|
return $this->secondFactorType; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function getDisplayLocale(): string |
|
64
|
|
|
{ |
|
65
|
|
|
return $this->displayLocale; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function getSecondFactorIdentifier(): string |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->secondFactorIdentifier; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function getInstitution(): string |
|
74
|
|
|
{ |
|
75
|
|
|
return 'inst-mock'; |
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.