1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Surfnet\StepupGateway\Behat\Service; |
4
|
|
|
|
5
|
|
|
use Exception; |
6
|
|
|
use Surfnet\StepupGateway\Behat\Repository\SamlEntityRepository; |
7
|
|
|
use Surfnet\StepupGateway\Behat\Repository\SecondFactorRepository; |
8
|
|
|
use Surfnet\StepupGateway\Behat\Repository\WhitelistRepository; |
9
|
|
|
|
10
|
|
|
class FixtureService |
11
|
|
|
{ |
12
|
|
|
private $secondFactorRepository; |
13
|
|
|
|
14
|
|
|
private $samlEntityRepository; |
15
|
|
|
|
16
|
|
|
private $whitelistRepository; |
17
|
|
|
|
18
|
|
|
public function __construct( |
19
|
|
|
SecondFactorRepository $secondFactorRepository, |
20
|
|
|
SamlEntityRepository $samlRepository, |
21
|
|
|
WhitelistRepository $whitelistRepository |
22
|
|
|
) { |
23
|
|
|
$this->secondFactorRepository = $secondFactorRepository; |
24
|
|
|
$this->samlEntityRepository = $samlRepository; |
25
|
|
|
$this->whitelistRepository = $whitelistRepository; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @param string $nameId |
30
|
|
|
* @param string $institution |
31
|
|
|
* @return array |
32
|
|
|
* @throws Exception |
33
|
|
|
*/ |
34
|
|
|
public function registerYubikeyToken($nameId, $institution) |
35
|
|
|
{ |
36
|
|
|
return $this->secondFactorRepository->create($nameId, 'yubikey', $institution); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param string $entityId |
41
|
|
|
* @param string $certificate |
42
|
|
|
* @param bool $sfoEnabled |
43
|
|
|
* @return array |
44
|
|
|
* @throws Exception |
45
|
|
|
*/ |
46
|
|
|
public function registerSP($entityId, $certificate, $sfoEnabled) |
47
|
|
|
{ |
48
|
|
|
return $this->samlEntityRepository->createSp($entityId, $certificate, $sfoEnabled); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @param string $institution |
53
|
|
|
* @return array |
54
|
|
|
* @throws Exception |
55
|
|
|
*/ |
56
|
|
|
public function whitelist($institution) |
57
|
|
|
{ |
58
|
|
|
return $this->whitelistRepository->whitelist($institution); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|