1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2014 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\StepupGateway\GatewayBundle\Entity; |
20
|
|
|
|
21
|
|
|
use Doctrine\ORM\Mapping as ORM; |
22
|
|
|
use Surfnet\StepupBundle\Value\Loa; |
23
|
|
|
use Surfnet\StepupBundle\Value\SecondFactorType; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @ORM\Entity(repositoryClass="Surfnet\StepupGateway\GatewayBundle\Entity\DoctrineSecondFactorRepository") |
27
|
|
|
* @ORM\Table |
28
|
|
|
*/ |
29
|
|
|
class SecondFactor |
30
|
|
|
{ |
31
|
|
|
/** |
32
|
|
|
* @var string |
33
|
|
|
* |
34
|
|
|
* @ORM\Id |
35
|
|
|
* @ORM\Column(length=36) |
36
|
|
|
*/ |
37
|
|
|
public $identityId; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var string |
41
|
|
|
* |
42
|
|
|
* @ORM\Column(length=200) |
43
|
|
|
*/ |
44
|
|
|
public $nameId; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var string |
48
|
|
|
* |
49
|
|
|
* @ORM\Column(length=200) |
50
|
|
|
*/ |
51
|
|
|
public $institution; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var string |
55
|
|
|
* |
56
|
|
|
* @ORM\Column(length=36) |
57
|
|
|
*/ |
58
|
|
|
public $secondFactorId; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var string |
62
|
|
|
* |
63
|
|
|
* @ORM\Column(length=50) |
64
|
|
|
*/ |
65
|
|
|
public $secondFactorType; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @var string |
69
|
|
|
* |
70
|
|
|
* @ORM\Column(length=255) |
71
|
|
|
*/ |
72
|
|
|
public $secondFactorIdentifier; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* In which language to display any second factor verification screens. |
76
|
|
|
* |
77
|
|
|
* @var string |
78
|
|
|
* |
79
|
|
|
* @ORM\Column |
80
|
|
|
*/ |
81
|
|
|
public $displayLocale; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* No new second factors should be created by the gateway |
85
|
|
|
*/ |
86
|
|
|
final private function __construct() |
|
|
|
|
87
|
|
|
{ |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @param Loa $loa |
92
|
|
|
* @return bool |
93
|
|
|
*/ |
94
|
|
|
public function canSatisfy(Loa $loa) |
95
|
|
|
{ |
96
|
|
|
return (new SecondFactorType($this->secondFactorType))->canSatisfy($loa); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return int |
101
|
|
|
*/ |
102
|
|
|
public function getLoaLevel() |
103
|
|
|
{ |
104
|
|
|
return (new SecondFactorType($this->secondFactorType))->getLevel(); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @return bool |
109
|
|
|
*/ |
110
|
|
|
public function requiresGssf() |
111
|
|
|
{ |
112
|
|
|
return (new SecondFactorType($this->secondFactorType))->isGssf(); |
113
|
|
|
} |
114
|
|
|
} |
115
|
|
|
|