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