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