1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2022 SURFnet B.V. |
5
|
|
|
* |
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
7
|
|
|
* you may not use this file except in compliance with the License. |
8
|
|
|
* You may obtain a copy of the License at |
9
|
|
|
* |
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
* |
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15
|
|
|
* See the License for the specific language governing permissions and |
16
|
|
|
* limitations under the License. |
17
|
|
|
*/ |
|
|
|
|
18
|
|
|
|
19
|
|
|
namespace Surfnet\Stepup\Identity\Value; |
20
|
|
|
|
21
|
|
|
class SelfAssertedRegistrationVettingType implements VettingType |
|
|
|
|
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
protected string $type = VettingType::TYPE_SELF_ASSERTED_REGISTRATION; |
27
|
|
|
|
28
|
|
|
public function __construct(protected RecoveryTokenId $authoringRecoveryToken) |
29
|
|
|
{ |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public static function deserialize(array $data): self |
33
|
|
|
{ |
34
|
|
|
$recoveryTokenId = new RecoveryTokenId($data['recovery_token_id']); |
35
|
|
|
return new self($recoveryTokenId); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function auditLog(): string |
39
|
|
|
{ |
40
|
|
|
return sprintf(' (self asserted registration using recovery token: %s)', $this->authoringRecoveryToken); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function authoringRecoveryToken(): RecoveryTokenId |
44
|
|
|
{ |
45
|
|
|
return $this->authoringRecoveryToken; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function jsonSerialize(): array |
49
|
|
|
{ |
50
|
|
|
return [ |
51
|
|
|
'type' => $this->type(), |
52
|
|
|
'recovery_token_id' => (string)$this->authoringRecoveryToken, |
53
|
|
|
]; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function type(): string |
57
|
|
|
{ |
58
|
|
|
return $this->type; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function __toString(): string |
62
|
|
|
{ |
63
|
|
|
return $this->type(); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function getDocumentNumber(): ?DocumentNumber |
67
|
|
|
{ |
68
|
|
|
return null; |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|