@@ 186-207 (lines=22) @@ | ||
183 | $this->eventSourcedRepository->save($identity); |
|
184 | } |
|
185 | ||
186 | public function handleProveYubikeyPossessionCommand(ProveYubikeyPossessionCommand $command) |
|
187 | { |
|
188 | /** @var IdentityApi $identity */ |
|
189 | $identity = $this->eventSourcedRepository->load(new IdentityId($command->identityId)); |
|
190 | ||
191 | $this->assertSecondFactorIsAllowedFor(new SecondFactorType('yubikey'), $identity->getInstitution()); |
|
192 | ||
193 | $configurationInstitution = new ConfigurationInstitution( |
|
194 | (string) $identity->getInstitution() |
|
195 | ); |
|
196 | $tokenCount = $this->institutionConfigurationOptionsService->getMaxNumberOfTokensFor($configurationInstitution); |
|
197 | $identity->setMaxNumberOfTokens($tokenCount); |
|
198 | ||
199 | $identity->provePossessionOfYubikey( |
|
200 | new SecondFactorId($command->secondFactorId), |
|
201 | new YubikeyPublicId($command->yubikeyPublicId), |
|
202 | $this->emailVerificationIsRequired($identity), |
|
203 | $this->configurableSettings->createNewEmailVerificationWindow() |
|
204 | ); |
|
205 | ||
206 | $this->eventSourcedRepository->save($identity); |
|
207 | } |
|
208 | ||
209 | /** |
|
210 | * @param ProvePhonePossessionCommand $command |
|
@@ 212-234 (lines=23) @@ | ||
209 | /** |
|
210 | * @param ProvePhonePossessionCommand $command |
|
211 | */ |
|
212 | public function handleProvePhonePossessionCommand(ProvePhonePossessionCommand $command) |
|
213 | { |
|
214 | /** @var IdentityApi $identity */ |
|
215 | $identity = $this->eventSourcedRepository->load(new IdentityId($command->identityId)); |
|
216 | ||
217 | $this->assertSecondFactorIsAllowedFor(new SecondFactorType('sms'), $identity->getInstitution()); |
|
218 | ||
219 | $configurationInstitution = new ConfigurationInstitution( |
|
220 | (string) $identity->getInstitution() |
|
221 | ); |
|
222 | ||
223 | $tokenCount = $this->institutionConfigurationOptionsService->getMaxNumberOfTokensFor($configurationInstitution); |
|
224 | $identity->setMaxNumberOfTokens($tokenCount); |
|
225 | ||
226 | $identity->provePossessionOfPhone( |
|
227 | new SecondFactorId($command->secondFactorId), |
|
228 | new PhoneNumber($command->phoneNumber), |
|
229 | $this->emailVerificationIsRequired($identity), |
|
230 | $this->configurableSettings->createNewEmailVerificationWindow() |
|
231 | ); |
|
232 | ||
233 | $this->eventSourcedRepository->save($identity); |
|
234 | } |
|
235 | ||
236 | /** |
|
237 | * @param ProveGssfPossessionCommand $command |
|
@@ 266-288 (lines=23) @@ | ||
263 | $this->eventSourcedRepository->save($identity); |
|
264 | } |
|
265 | ||
266 | public function handleProveU2fDevicePossessionCommand(ProveU2fDevicePossessionCommand $command) |
|
267 | { |
|
268 | /** @var IdentityApi $identity */ |
|
269 | $identity = $this->eventSourcedRepository->load(new IdentityId($command->identityId)); |
|
270 | ||
271 | $this->assertSecondFactorIsAllowedFor(new SecondFactorType('u2f'), $identity->getInstitution()); |
|
272 | ||
273 | $configurationInstitution = new ConfigurationInstitution( |
|
274 | (string) $identity->getInstitution() |
|
275 | ); |
|
276 | ||
277 | $tokenCount = $this->institutionConfigurationOptionsService->getMaxNumberOfTokensFor($configurationInstitution); |
|
278 | $identity->setMaxNumberOfTokens($tokenCount); |
|
279 | ||
280 | $identity->provePossessionOfU2fDevice( |
|
281 | new SecondFactorId($command->secondFactorId), |
|
282 | new U2fKeyHandle($command->keyHandle), |
|
283 | $this->emailVerificationIsRequired($identity), |
|
284 | $this->configurableSettings->createNewEmailVerificationWindow() |
|
285 | ); |
|
286 | ||
287 | $this->eventSourcedRepository->save($identity); |
|
288 | } |
|
289 | ||
290 | /** |
|
291 | * @param VerifyEmailCommand $command |