@@ 189-206 (lines=18) @@ | ||
186 | $this->eventSourcedRepository->save($identity); |
|
187 | } |
|
188 | ||
189 | public function handleProveYubikeyPossessionCommand(ProveYubikeyPossessionCommand $command) |
|
190 | { |
|
191 | /** @var IdentityApi $identity */ |
|
192 | $identity = $this->eventSourcedRepository->load(new IdentityId($command->identityId)); |
|
193 | ||
194 | $identity->setMaxNumberOfTokens($this->numberOfTokensPerIdentity); |
|
195 | ||
196 | $this->assertSecondFactorIsAllowedFor(new SecondFactorType('yubikey'), $identity->getInstitution()); |
|
197 | ||
198 | $identity->provePossessionOfYubikey( |
|
199 | new SecondFactorId($command->secondFactorId), |
|
200 | new YubikeyPublicId($command->yubikeyPublicId), |
|
201 | $this->emailVerificationIsRequired($identity), |
|
202 | $this->configurableSettings->createNewEmailVerificationWindow() |
|
203 | ); |
|
204 | ||
205 | $this->eventSourcedRepository->save($identity); |
|
206 | } |
|
207 | ||
208 | /** |
|
209 | * @param ProvePhonePossessionCommand $command |
|
@@ 211-228 (lines=18) @@ | ||
208 | /** |
|
209 | * @param ProvePhonePossessionCommand $command |
|
210 | */ |
|
211 | public function handleProvePhonePossessionCommand(ProvePhonePossessionCommand $command) |
|
212 | { |
|
213 | /** @var IdentityApi $identity */ |
|
214 | $identity = $this->eventSourcedRepository->load(new IdentityId($command->identityId)); |
|
215 | ||
216 | $this->assertSecondFactorIsAllowedFor(new SecondFactorType('sms'), $identity->getInstitution()); |
|
217 | ||
218 | $identity->setMaxNumberOfTokens($this->numberOfTokensPerIdentity); |
|
219 | ||
220 | $identity->provePossessionOfPhone( |
|
221 | new SecondFactorId($command->secondFactorId), |
|
222 | new PhoneNumber($command->phoneNumber), |
|
223 | $this->emailVerificationIsRequired($identity), |
|
224 | $this->configurableSettings->createNewEmailVerificationWindow() |
|
225 | ); |
|
226 | ||
227 | $this->eventSourcedRepository->save($identity); |
|
228 | } |
|
229 | ||
230 | /** |
|
231 | * @param ProveGssfPossessionCommand $command |
|
@@ 256-273 (lines=18) @@ | ||
253 | $this->eventSourcedRepository->save($identity); |
|
254 | } |
|
255 | ||
256 | public function handleProveU2fDevicePossessionCommand(ProveU2fDevicePossessionCommand $command) |
|
257 | { |
|
258 | /** @var IdentityApi $identity */ |
|
259 | $identity = $this->eventSourcedRepository->load(new IdentityId($command->identityId)); |
|
260 | ||
261 | $this->assertSecondFactorIsAllowedFor(new SecondFactorType('u2f'), $identity->getInstitution()); |
|
262 | ||
263 | $identity->setMaxNumberOfTokens($this->numberOfTokensPerIdentity); |
|
264 | ||
265 | $identity->provePossessionOfU2fDevice( |
|
266 | new SecondFactorId($command->secondFactorId), |
|
267 | new U2fKeyHandle($command->keyHandle), |
|
268 | $this->emailVerificationIsRequired($identity), |
|
269 | $this->configurableSettings->createNewEmailVerificationWindow() |
|
270 | ); |
|
271 | ||
272 | $this->eventSourcedRepository->save($identity); |
|
273 | } |
|
274 | ||
275 | /** |
|
276 | * @param VerifyEmailCommand $command |