1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2022 SURFnet bv |
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\StepupMiddleware\CommandHandlingBundle\Identity\Command; |
20
|
|
|
|
21
|
|
|
use Surfnet\Stepup\Identity\Value\RecoveryTokenType; |
22
|
|
|
use Surfnet\StepupMiddleware\CommandHandlingBundle\Command\AbstractCommand; |
23
|
|
|
use Surfnet\StepupMiddleware\CommandHandlingBundle\Command\SelfServiceExecutable; |
24
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
25
|
|
|
|
26
|
|
|
class ProvePhoneRecoveryTokenPossessionCommand extends AbstractCommand implements SelfServiceExecutable |
|
|
|
|
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* The ID of an existing identity. |
30
|
|
|
*/ |
31
|
|
|
#[Assert\NotBlank] |
32
|
|
|
#[Assert\Type(type: 'string')] |
33
|
|
|
public string $identityId; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* The ID of the recovery code to create. |
37
|
|
|
*/ |
38
|
|
|
#[Assert\NotBlank] |
39
|
|
|
#[Assert\Type(type: 'string')] |
40
|
|
|
public string $recoveryTokenId; |
41
|
|
|
|
42
|
|
|
#[Assert\NotBlank] |
43
|
|
|
#[Assert\Type(type: 'string')] |
44
|
|
|
public string $recoveryTokenType = RecoveryTokenType::TYPE_SMS; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* The phone number |
48
|
|
|
*/ |
49
|
|
|
#[Assert\NotBlank] |
50
|
|
|
#[Assert\Type(type: 'string')] |
51
|
|
|
#[Assert\Regex(pattern: '~^\+[\d\s]+ \(0\) \d+$~')] |
52
|
|
|
public string $phoneNumber; |
53
|
|
|
|
54
|
|
|
public function getIdentityId(): string |
55
|
|
|
{ |
56
|
|
|
return $this->identityId; |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|