|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Copyright 2016 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\Configuration\Event; |
|
20
|
|
|
|
|
21
|
|
|
use Broadway\Serializer\SerializableInterface; |
|
22
|
|
|
use Surfnet\Stepup\Configuration\Value\Institution; |
|
23
|
|
|
use Surfnet\Stepup\Configuration\Value\InstitutionConfigurationId; |
|
24
|
|
|
use Surfnet\Stepup\Configuration\Value\NumberOfTokensPerIdentityOption; |
|
25
|
|
|
use Surfnet\Stepup\Configuration\Value\SelectRaaOption; |
|
26
|
|
|
use Surfnet\Stepup\Configuration\Value\ShowRaaContactInformationOption; |
|
27
|
|
|
use Surfnet\Stepup\Configuration\Value\UseRaaOption; |
|
28
|
|
|
use Surfnet\Stepup\Configuration\Value\UseRaLocationsOption; |
|
29
|
|
|
use Surfnet\Stepup\Configuration\Value\UseRaOption; |
|
30
|
|
|
use Surfnet\Stepup\Configuration\Value\VerifyEmailOption; |
|
31
|
|
|
|
|
32
|
|
|
class NewInstitutionConfigurationCreatedEvent implements SerializableInterface |
|
33
|
|
|
{ |
|
34
|
|
|
/** |
|
35
|
|
|
* @var InstitutionConfigurationId |
|
36
|
|
|
*/ |
|
37
|
|
|
public $institutionConfigurationId; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var Institution |
|
41
|
|
|
*/ |
|
42
|
|
|
public $institution; |
|
43
|
|
|
/** |
|
44
|
|
|
* @var UseRaLocationsOption |
|
45
|
|
|
*/ |
|
46
|
|
|
public $useRaLocationsOption; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var ShowRaaContactInformationOption |
|
50
|
|
|
*/ |
|
51
|
|
|
public $showRaaContactInformationOption; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @var VerifyEmailOption |
|
55
|
|
|
*/ |
|
56
|
|
|
public $verifyEmailOption; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @var NumberOfTokensPerIdentityOption |
|
60
|
|
|
*/ |
|
61
|
|
|
public $numberOfTokensPerIdentityOption; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @var UseRaOption |
|
65
|
|
|
*/ |
|
66
|
|
|
public $useRaOption; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @var UseRaaOption |
|
70
|
|
|
*/ |
|
71
|
|
|
public $useRaaOption; |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @var SelectRaaOption |
|
75
|
|
|
*/ |
|
76
|
|
|
public $selectRaaOption; |
|
77
|
|
|
|
|
78
|
|
|
public function __construct( |
|
79
|
|
|
InstitutionConfigurationId $institutionConfigurationId, |
|
80
|
|
|
Institution $institution, |
|
81
|
|
|
UseRaLocationsOption $useRaLocationsOption, |
|
82
|
|
|
ShowRaaContactInformationOption $showRaaContactInformationOption, |
|
83
|
|
|
VerifyEmailOption $verifyEmailOption, |
|
84
|
|
|
NumberOfTokensPerIdentityOption $numberOfTokensPerIdentityOption, |
|
85
|
|
|
UseRaOption $useRaOption, |
|
86
|
|
|
UseRaaOption $useRaaOption, |
|
87
|
|
|
SelectRaaOption $selectRaaOption |
|
88
|
|
|
) { |
|
89
|
|
|
$this->institutionConfigurationId = $institutionConfigurationId; |
|
90
|
|
|
$this->institution = $institution; |
|
91
|
|
|
$this->useRaLocationsOption = $useRaLocationsOption; |
|
92
|
|
|
$this->showRaaContactInformationOption = $showRaaContactInformationOption; |
|
93
|
|
|
$this->verifyEmailOption = $verifyEmailOption; |
|
94
|
|
|
$this->numberOfTokensPerIdentityOption = $numberOfTokensPerIdentityOption; |
|
95
|
|
|
$this->useRaOption = $useRaOption; |
|
96
|
|
|
$this->useRaaOption = $useRaaOption; |
|
97
|
|
|
$this->selectRaaOption = $selectRaaOption; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
public static function deserialize(array $data) |
|
101
|
|
|
{ |
|
102
|
|
|
if (!isset($data['verify_email_option'])) { |
|
103
|
|
|
$data['verify_email_option'] = true; |
|
104
|
|
|
} |
|
105
|
|
|
if (!isset($data['number_of_tokens_per_identity_option'])) { |
|
106
|
|
|
$data['number_of_tokens_per_identity_option'] = NumberOfTokensPerIdentityOption::DISABLED; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
// Support FGA options on PRE FGA events |
|
110
|
|
|
if (!isset($data['use_ra_option'])) { |
|
111
|
|
|
$data['use_ra_option'] = UseRaOption::getDefault()->getUseRaOption(); |
|
112
|
|
|
} |
|
113
|
|
|
if (!isset($data['use_raa_option'])) { |
|
114
|
|
|
$data['use_raa_option'] = UseRaaOption::getDefault()->getUseRaaOption(); |
|
115
|
|
|
} |
|
116
|
|
|
if (!isset($data['select_raa_option'])) { |
|
117
|
|
|
$data['select_raa_option'] = SelectRaaOption::getDefault()->getSelectRaaOption(); |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
return new self( |
|
121
|
|
|
new InstitutionConfigurationId($data['institution_configuration_id']), |
|
122
|
|
|
new Institution($data['institution']), |
|
123
|
|
|
new UseRaLocationsOption($data['use_ra_locations_option']), |
|
124
|
|
|
new ShowRaaContactInformationOption($data['show_raa_contact_information_option']), |
|
125
|
|
|
new VerifyEmailOption($data['verify_email_option']), |
|
126
|
|
|
new NumberOfTokensPerIdentityOption($data['number_of_tokens_per_identity_option']), |
|
127
|
|
|
new UseRaOption($data['use_ra_option']), |
|
128
|
|
|
new UseRaaOption($data['use_raa_option']), |
|
129
|
|
|
new SelectRaaOption($data['select_raa_option']) |
|
130
|
|
|
); |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
public function serialize() |
|
134
|
|
|
{ |
|
135
|
|
|
return [ |
|
136
|
|
|
'institution_configuration_id' => $this->institutionConfigurationId->getInstitutionConfigurationId(), |
|
137
|
|
|
'institution' => $this->institution->getInstitution(), |
|
138
|
|
|
'use_ra_locations_option' => $this->useRaLocationsOption->isEnabled(), |
|
139
|
|
|
'show_raa_contact_information_option' => $this->showRaaContactInformationOption->isEnabled(), |
|
140
|
|
|
'verify_email_option' => $this->verifyEmailOption->isEnabled(), |
|
141
|
|
|
'number_of_tokens_per_identity_option' => $this->numberOfTokensPerIdentityOption->getNumberOfTokensPerIdentity(), |
|
142
|
|
|
'use_ra_option' => $this->useRaOption->getUseRaOption(), |
|
143
|
|
|
'use_raa_option' => $this->useRaaOption->getUseRaaOption(), |
|
144
|
|
|
'select_raa_option' => $this->selectRaaOption->getSelectRaaOption(), |
|
145
|
|
|
]; |
|
146
|
|
|
} |
|
147
|
|
|
} |
|
148
|
|
|
|