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