| @@ 226-267 (lines=42) @@ | ||
| 223 | ); |
|
| 224 | } |
|
| 225 | ||
| 226 | public function provePossessionOfYubikey( |
|
| 227 | SecondFactorId $secondFactorId, |
|
| 228 | YubikeyPublicId $yubikeyPublicId, |
|
| 229 | $emailVerificationRequired, |
|
| 230 | EmailVerificationWindow $emailVerificationWindow |
|
| 231 | ) { |
|
| 232 | $this->assertNotForgotten(); |
|
| 233 | $this->assertUserMayAddSecondFactor(); |
|
| 234 | ||
| 235 | if ($emailVerificationRequired) { |
|
| 236 | $emailVerificationNonce = TokenGenerator::generateNonce(); |
|
| 237 | ||
| 238 | $this->apply( |
|
| 239 | new YubikeyPossessionProvenEvent( |
|
| 240 | $this->id, |
|
| 241 | $this->institution, |
|
| 242 | $secondFactorId, |
|
| 243 | $yubikeyPublicId, |
|
| 244 | $emailVerificationRequired, |
|
| 245 | $emailVerificationWindow, |
|
| 246 | $emailVerificationNonce, |
|
| 247 | $this->commonName, |
|
| 248 | $this->email, |
|
| 249 | $this->preferredLocale |
|
| 250 | ) |
|
| 251 | ); |
|
| 252 | } else { |
|
| 253 | $this->apply( |
|
| 254 | new YubikeyPossessionProvenAndVerifiedEvent( |
|
| 255 | $this->id, |
|
| 256 | $this->institution, |
|
| 257 | $secondFactorId, |
|
| 258 | $yubikeyPublicId, |
|
| 259 | $this->commonName, |
|
| 260 | $this->email, |
|
| 261 | $this->preferredLocale, |
|
| 262 | DateTime::now(), |
|
| 263 | OtpGenerator::generate(8) |
|
| 264 | ) |
|
| 265 | ); |
|
| 266 | } |
|
| 267 | } |
|
| 268 | ||
| 269 | public function provePossessionOfPhone( |
|
| 270 | SecondFactorId $secondFactorId, |
|
| @@ 269-310 (lines=42) @@ | ||
| 266 | } |
|
| 267 | } |
|
| 268 | ||
| 269 | public function provePossessionOfPhone( |
|
| 270 | SecondFactorId $secondFactorId, |
|
| 271 | PhoneNumber $phoneNumber, |
|
| 272 | $emailVerificationRequired, |
|
| 273 | EmailVerificationWindow $emailVerificationWindow |
|
| 274 | ) { |
|
| 275 | $this->assertNotForgotten(); |
|
| 276 | $this->assertUserMayAddSecondFactor(); |
|
| 277 | ||
| 278 | if ($emailVerificationRequired) { |
|
| 279 | $emailVerificationNonce = TokenGenerator::generateNonce(); |
|
| 280 | ||
| 281 | $this->apply( |
|
| 282 | new PhonePossessionProvenEvent( |
|
| 283 | $this->id, |
|
| 284 | $this->institution, |
|
| 285 | $secondFactorId, |
|
| 286 | $phoneNumber, |
|
| 287 | $emailVerificationRequired, |
|
| 288 | $emailVerificationWindow, |
|
| 289 | $emailVerificationNonce, |
|
| 290 | $this->commonName, |
|
| 291 | $this->email, |
|
| 292 | $this->preferredLocale |
|
| 293 | ) |
|
| 294 | ); |
|
| 295 | } else { |
|
| 296 | $this->apply( |
|
| 297 | new PhonePossessionProvenAndVerifiedEvent( |
|
| 298 | $this->id, |
|
| 299 | $this->institution, |
|
| 300 | $secondFactorId, |
|
| 301 | $phoneNumber, |
|
| 302 | $this->commonName, |
|
| 303 | $this->email, |
|
| 304 | $this->preferredLocale, |
|
| 305 | DateTime::now(), |
|
| 306 | OtpGenerator::generate(8) |
|
| 307 | ) |
|
| 308 | ); |
|
| 309 | } |
|
| 310 | } |
|
| 311 | ||
| 312 | public function provePossessionOfGssf( |
|
| 313 | SecondFactorId $secondFactorId, |
|
| @@ 312-356 (lines=45) @@ | ||
| 309 | } |
|
| 310 | } |
|
| 311 | ||
| 312 | public function provePossessionOfGssf( |
|
| 313 | SecondFactorId $secondFactorId, |
|
| 314 | StepupProvider $provider, |
|
| 315 | GssfId $gssfId, |
|
| 316 | $emailVerificationRequired, |
|
| 317 | EmailVerificationWindow $emailVerificationWindow |
|
| 318 | ) { |
|
| 319 | $this->assertNotForgotten(); |
|
| 320 | $this->assertUserMayAddSecondFactor(); |
|
| 321 | ||
| 322 | if ($emailVerificationRequired) { |
|
| 323 | $emailVerificationNonce = TokenGenerator::generateNonce(); |
|
| 324 | ||
| 325 | $this->apply( |
|
| 326 | new GssfPossessionProvenEvent( |
|
| 327 | $this->id, |
|
| 328 | $this->institution, |
|
| 329 | $secondFactorId, |
|
| 330 | $provider, |
|
| 331 | $gssfId, |
|
| 332 | $emailVerificationRequired, |
|
| 333 | $emailVerificationWindow, |
|
| 334 | $emailVerificationNonce, |
|
| 335 | $this->commonName, |
|
| 336 | $this->email, |
|
| 337 | $this->preferredLocale |
|
| 338 | ) |
|
| 339 | ); |
|
| 340 | } else { |
|
| 341 | $this->apply( |
|
| 342 | new GssfPossessionProvenAndVerifiedEvent( |
|
| 343 | $this->id, |
|
| 344 | $this->institution, |
|
| 345 | $secondFactorId, |
|
| 346 | $provider, |
|
| 347 | $gssfId, |
|
| 348 | $this->commonName, |
|
| 349 | $this->email, |
|
| 350 | $this->preferredLocale, |
|
| 351 | DateTime::now(), |
|
| 352 | OtpGenerator::generate(8) |
|
| 353 | ) |
|
| 354 | ); |
|
| 355 | } |
|
| 356 | } |
|
| 357 | ||
| 358 | public function verifyEmail($verificationNonce) |
|
| 359 | { |
|