Commit 96c1e2c
Add FXIOS-16685 [FxA Pairflow] Support pairing v2 via WebChannel OAuth Part 1 (#35460)
Add FXIOS-16685 [FxA Pairflow] Support pairing v2 via WebChannel OAuth
Load the pairing deep link directly in the WebChannel web view, instead of
converting it to a supplicant URL through beginPairingAuthentication. The page
then asks the app for OAuth parameters with fxaccounts:pair_oauth_start, and
FxAPairingOAuthHandler answers with the state, scope, code_challenge,
code_challenge_method and keys_jwk it reads back from the flow.
Advertise pairingVersion 2 in the fxaccounts:fxa_status capabilities, so the
content server can choose the v2 path. The server gates the flow on its own
pairing.version config as well, so both sides must agree before v2 runs.
Give the deep link its own FxAPageType. The qrCode case also serves the in-app
scanner and the debug setting. Both start their own OAuth flow before the page
loads, so neither may satisfy the pair_oauth_start gate.
Wait for the account manager before presenting the modal, so a cold-launch
deep link is not dropped. The wait runs a @sendable closure off the main actor,
so hop back through ensureMainThread, matching the other AppEventQueue.wait
call sites in that file. Track the wait token and cancel it in deinit.
Reject WebChannel messages from subframes, and reply to a pair_oauth_start the
app cannot serve rather than leaving the page waiting. Log when a reply is
dropped because the view model or the web view went away.
Extract the WebChannel reply envelope into webChannelReplyScript and test it.
The envelope is a protocol contract with the content server: the page matches
the reply against the id it sent, so messageId is emitted as a number rather
than a string. Cover the redirect policy after login, the title composition,
the user script setup and message id parsing, none of which had tests.
Co-authored-by: Matt Lichtenstein <lichtensteinmp@gmail.com>1 parent 8b84e1d commit 96c1e2c
7 files changed
Lines changed: 620 additions & 39 deletions
File tree
- firefox-ios
- Client.xcodeproj
- Client/Frontend
- Browser/BrowserViewController/Views
- Settings/Main/Debug
- RustFxA
- firefox-ios-tests/Tests/ClientTests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| |||
2853 | 2855 | | |
2854 | 2856 | | |
2855 | 2857 | | |
| 2858 | + | |
| 2859 | + | |
2856 | 2860 | | |
2857 | 2861 | | |
2858 | 2862 | | |
| |||
16304 | 16308 | | |
16305 | 16309 | | |
16306 | 16310 | | |
| 16311 | + | |
16307 | 16312 | | |
16308 | 16313 | | |
16309 | 16314 | | |
| |||
17534 | 17539 | | |
17535 | 17540 | | |
17536 | 17541 | | |
| 17542 | + | |
17537 | 17543 | | |
17538 | 17544 | | |
17539 | 17545 | | |
| |||
19779 | 19785 | | |
19780 | 19786 | | |
19781 | 19787 | | |
| 19788 | + | |
19782 | 19789 | | |
19783 | 19790 | | |
19784 | 19791 | | |
| |||
21272 | 21279 | | |
21273 | 21280 | | |
21274 | 21281 | | |
| 21282 | + | |
21275 | 21283 | | |
21276 | 21284 | | |
21277 | 21285 | | |
| |||
Lines changed: 36 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| |||
266 | 265 | | |
267 | 266 | | |
268 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
269 | 271 | | |
270 | 272 | | |
271 | 273 | | |
| |||
509 | 511 | | |
510 | 512 | | |
511 | 513 | | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
512 | 517 | | |
513 | 518 | | |
514 | 519 | | |
| |||
3407 | 3412 | | |
3408 | 3413 | | |
3409 | 3414 | | |
3410 | | - | |
3411 | | - | |
3412 | | - | |
3413 | | - | |
3414 | | - | |
3415 | | - | |
3416 | | - | |
3417 | | - | |
3418 | | - | |
3419 | | - | |
3420 | | - | |
3421 | | - | |
3422 | | - | |
3423 | | - | |
3424 | | - | |
3425 | | - | |
3426 | | - | |
3427 | | - | |
3428 | | - | |
3429 | | - | |
| 3415 | + | |
| 3416 | + | |
| 3417 | + | |
| 3418 | + | |
| 3419 | + | |
| 3420 | + | |
| 3421 | + | |
| 3422 | + | |
| 3423 | + | |
| 3424 | + | |
| 3425 | + | |
| 3426 | + | |
| 3427 | + | |
| 3428 | + | |
| 3429 | + | |
| 3430 | + | |
| 3431 | + | |
3430 | 3432 | | |
| 3433 | + | |
| 3434 | + | |
| 3435 | + | |
| 3436 | + | |
| 3437 | + | |
| 3438 | + | |
| 3439 | + | |
| 3440 | + | |
| 3441 | + | |
| 3442 | + | |
| 3443 | + | |
| 3444 | + | |
| 3445 | + | |
3431 | 3446 | | |
3432 | 3447 | | |
3433 | 3448 | | |
| |||
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | | - | |
75 | | - | |
| 73 | + | |
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
0 commit comments