| @@ 215-244 (lines=30) @@ | ||
| 212 | ); |
|
| 213 | } |
|
| 214 | ||
| 215 | public function provePossessionOfYubikey( |
|
| 216 | SecondFactorId $secondFactorId, |
|
| 217 | YubikeyPublicId $yubikeyPublicId, |
|
| 218 | $emailVerificationRequired, |
|
| 219 | EmailVerificationWindow $emailVerificationWindow |
|
| 220 | ) { |
|
| 221 | $this->assertNotForgotten(); |
|
| 222 | $this->assertUserMayAddSecondFactor(); |
|
| 223 | ||
| 224 | $emailVerificationNonce = TokenGenerator::generateNonce(); |
|
| 225 | ||
| 226 | $this->apply( |
|
| 227 | new YubikeyPossessionProvenEvent( |
|
| 228 | $this->id, |
|
| 229 | $this->institution, |
|
| 230 | $secondFactorId, |
|
| 231 | $yubikeyPublicId, |
|
| 232 | $emailVerificationRequired, |
|
| 233 | $emailVerificationWindow, |
|
| 234 | $emailVerificationNonce, |
|
| 235 | $this->commonName, |
|
| 236 | $this->email, |
|
| 237 | $this->preferredLocale |
|
| 238 | ) |
|
| 239 | ); |
|
| 240 | ||
| 241 | if (!$emailVerificationRequired) { |
|
| 242 | $this->verifyImplicitly($secondFactorId); |
|
| 243 | } |
|
| 244 | } |
|
| 245 | ||
| 246 | public function provePossessionOfPhone( |
|
| 247 | SecondFactorId $secondFactorId, |
|
| @@ 246-275 (lines=30) @@ | ||
| 243 | } |
|
| 244 | } |
|
| 245 | ||
| 246 | public function provePossessionOfPhone( |
|
| 247 | SecondFactorId $secondFactorId, |
|
| 248 | PhoneNumber $phoneNumber, |
|
| 249 | $emailVerificationRequired, |
|
| 250 | EmailVerificationWindow $emailVerificationWindow |
|
| 251 | ) { |
|
| 252 | $this->assertNotForgotten(); |
|
| 253 | $this->assertUserMayAddSecondFactor(); |
|
| 254 | ||
| 255 | $emailVerificationNonce = TokenGenerator::generateNonce(); |
|
| 256 | ||
| 257 | $this->apply( |
|
| 258 | new PhonePossessionProvenEvent( |
|
| 259 | $this->id, |
|
| 260 | $this->institution, |
|
| 261 | $secondFactorId, |
|
| 262 | $phoneNumber, |
|
| 263 | $emailVerificationRequired, |
|
| 264 | $emailVerificationWindow, |
|
| 265 | $emailVerificationNonce, |
|
| 266 | $this->commonName, |
|
| 267 | $this->email, |
|
| 268 | $this->preferredLocale |
|
| 269 | ) |
|
| 270 | ); |
|
| 271 | ||
| 272 | if (!$emailVerificationRequired) { |
|
| 273 | $this->verifyImplicitly($secondFactorId); |
|
| 274 | } |
|
| 275 | } |
|
| 276 | ||
| 277 | public function provePossessionOfGssf( |
|
| 278 | SecondFactorId $secondFactorId, |
|
| @@ 277-308 (lines=32) @@ | ||
| 274 | } |
|
| 275 | } |
|
| 276 | ||
| 277 | public function provePossessionOfGssf( |
|
| 278 | SecondFactorId $secondFactorId, |
|
| 279 | StepupProvider $provider, |
|
| 280 | GssfId $gssfId, |
|
| 281 | $emailVerificationRequired, |
|
| 282 | EmailVerificationWindow $emailVerificationWindow |
|
| 283 | ) { |
|
| 284 | $this->assertNotForgotten(); |
|
| 285 | $this->assertUserMayAddSecondFactor(); |
|
| 286 | ||
| 287 | $emailVerificationNonce = TokenGenerator::generateNonce(); |
|
| 288 | ||
| 289 | $this->apply( |
|
| 290 | new GssfPossessionProvenEvent( |
|
| 291 | $this->id, |
|
| 292 | $this->institution, |
|
| 293 | $secondFactorId, |
|
| 294 | $provider, |
|
| 295 | $gssfId, |
|
| 296 | $emailVerificationRequired, |
|
| 297 | $emailVerificationWindow, |
|
| 298 | $emailVerificationNonce, |
|
| 299 | $this->commonName, |
|
| 300 | $this->email, |
|
| 301 | $this->preferredLocale |
|
| 302 | ) |
|
| 303 | ); |
|
| 304 | ||
| 305 | if (!$emailVerificationRequired) { |
|
| 306 | $this->verifyImplicitly($secondFactorId); |
|
| 307 | } |
|
| 308 | } |
|
| 309 | ||
| 310 | public function provePossessionOfU2fDevice( |
|
| 311 | SecondFactorId $secondFactorId, |
|
| @@ 310-339 (lines=30) @@ | ||
| 307 | } |
|
| 308 | } |
|
| 309 | ||
| 310 | public function provePossessionOfU2fDevice( |
|
| 311 | SecondFactorId $secondFactorId, |
|
| 312 | U2fKeyHandle $keyHandle, |
|
| 313 | $emailVerificationRequired, |
|
| 314 | EmailVerificationWindow $emailVerificationWindow |
|
| 315 | ) { |
|
| 316 | $this->assertNotForgotten(); |
|
| 317 | $this->assertUserMayAddSecondFactor(); |
|
| 318 | ||
| 319 | $emailVerificationNonce = TokenGenerator::generateNonce(); |
|
| 320 | ||
| 321 | $this->apply( |
|
| 322 | new U2fDevicePossessionProvenEvent( |
|
| 323 | $this->id, |
|
| 324 | $this->institution, |
|
| 325 | $secondFactorId, |
|
| 326 | $keyHandle, |
|
| 327 | $emailVerificationRequired, |
|
| 328 | $emailVerificationWindow, |
|
| 329 | $emailVerificationNonce, |
|
| 330 | $this->commonName, |
|
| 331 | $this->email, |
|
| 332 | $this->preferredLocale |
|
| 333 | ) |
|
| 334 | ); |
|
| 335 | ||
| 336 | if (!$emailVerificationRequired) { |
|
| 337 | $this->verifyImplicitly($secondFactorId); |
|
| 338 | } |
|
| 339 | } |
|
| 340 | ||
| 341 | public function verifyEmail($verificationNonce) |
|
| 342 | { |
|