@@ 207-228 (lines=22) @@ | ||
204 | $this->eventSourcedRepository->save($identity); |
|
205 | } |
|
206 | ||
207 | public function handleProveYubikeyPossessionCommand(ProveYubikeyPossessionCommand $command) |
|
208 | { |
|
209 | /** @var IdentityApi $identity */ |
|
210 | $identity = $this->eventSourcedRepository->load(new IdentityId($command->identityId)); |
|
211 | ||
212 | $this->assertSecondFactorIsAllowedFor(new SecondFactorType('yubikey'), $identity->getInstitution()); |
|
213 | ||
214 | $configurationInstitution = new ConfigurationInstitution( |
|
215 | (string) $identity->getInstitution() |
|
216 | ); |
|
217 | $tokenCount = $this->institutionConfigurationOptionsService->getMaxNumberOfTokensFor($configurationInstitution); |
|
218 | $identity->setMaxNumberOfTokens($tokenCount); |
|
219 | ||
220 | $identity->provePossessionOfYubikey( |
|
221 | new SecondFactorId($command->secondFactorId), |
|
222 | new YubikeyPublicId($command->yubikeyPublicId), |
|
223 | $this->emailVerificationIsRequired($identity), |
|
224 | $this->configurableSettings->createNewEmailVerificationWindow() |
|
225 | ); |
|
226 | ||
227 | $this->eventSourcedRepository->save($identity); |
|
228 | } |
|
229 | ||
230 | /** |
|
231 | * @param ProvePhonePossessionCommand $command |
|
@@ 233-255 (lines=23) @@ | ||
230 | /** |
|
231 | * @param ProvePhonePossessionCommand $command |
|
232 | */ |
|
233 | public function handleProvePhonePossessionCommand(ProvePhonePossessionCommand $command) |
|
234 | { |
|
235 | /** @var IdentityApi $identity */ |
|
236 | $identity = $this->eventSourcedRepository->load(new IdentityId($command->identityId)); |
|
237 | ||
238 | $this->assertSecondFactorIsAllowedFor(new SecondFactorType('sms'), $identity->getInstitution()); |
|
239 | ||
240 | $configurationInstitution = new ConfigurationInstitution( |
|
241 | (string) $identity->getInstitution() |
|
242 | ); |
|
243 | ||
244 | $tokenCount = $this->institutionConfigurationOptionsService->getMaxNumberOfTokensFor($configurationInstitution); |
|
245 | $identity->setMaxNumberOfTokens($tokenCount); |
|
246 | ||
247 | $identity->provePossessionOfPhone( |
|
248 | new SecondFactorId($command->secondFactorId), |
|
249 | new PhoneNumber($command->phoneNumber), |
|
250 | $this->emailVerificationIsRequired($identity), |
|
251 | $this->configurableSettings->createNewEmailVerificationWindow() |
|
252 | ); |
|
253 | ||
254 | $this->eventSourcedRepository->save($identity); |
|
255 | } |
|
256 | ||
257 | /** |
|
258 | * @param ProveGssfPossessionCommand $command |
|
@@ 287-309 (lines=23) @@ | ||
284 | $this->eventSourcedRepository->save($identity); |
|
285 | } |
|
286 | ||
287 | public function handleProveU2fDevicePossessionCommand(ProveU2fDevicePossessionCommand $command) |
|
288 | { |
|
289 | /** @var IdentityApi $identity */ |
|
290 | $identity = $this->eventSourcedRepository->load(new IdentityId($command->identityId)); |
|
291 | ||
292 | $this->assertSecondFactorIsAllowedFor(new SecondFactorType('u2f'), $identity->getInstitution()); |
|
293 | ||
294 | $configurationInstitution = new ConfigurationInstitution( |
|
295 | (string) $identity->getInstitution() |
|
296 | ); |
|
297 | ||
298 | $tokenCount = $this->institutionConfigurationOptionsService->getMaxNumberOfTokensFor($configurationInstitution); |
|
299 | $identity->setMaxNumberOfTokens($tokenCount); |
|
300 | ||
301 | $identity->provePossessionOfU2fDevice( |
|
302 | new SecondFactorId($command->secondFactorId), |
|
303 | new U2fKeyHandle($command->keyHandle), |
|
304 | $this->emailVerificationIsRequired($identity), |
|
305 | $this->configurableSettings->createNewEmailVerificationWindow() |
|
306 | ); |
|
307 | ||
308 | $this->eventSourcedRepository->save($identity); |
|
309 | } |
|
310 | ||
311 | /** |
|
312 | * @param VerifyEmailCommand $command |