Commit f07204c
feat(be,fe): address SSO review feedback on dfinity#3785 (follow-up) (dfinity#3803)
Follow-up to dfinity#3785 addressing [@sea-snake's
review](dfinity#3785 (review)).
All five unresolved threads there are addressed here, and will be marked
resolved on dfinity#3785 with pointers back to this PR.
Stacked on top of dfinity#3785: this branch includes all commits from dfinity#3785
plus three new commits that cover the review fixes.
# Changes
## 1. `Sign in with SSO` → `Continue with SSO`
SSO button `aria-label` in `PickAuthenticationMethod` and
`AddAccessMethod`, and the h1 inside the SSO screen, now read "Continue
with SSO" — the downstream flow can end in either a sign-in or a
sign-up, so "Sign in" was misleading.
## 2. Slim `mapSubmitError` to user-actionable copy
`SignInWithSso.svelte#mapSubmitError` used to enumerate every shape of
provider misconfiguration (hostname mismatch, non-HTTPS endpoints,
malformed discovery document, ...). Those read as implementation-detail
leakage. Keep only the branches the user or their SSO admin can act on —
domain not configured, canary allowlist, OAuth provider errors from the
callback fragment, rate limits — and fall back to a generic `"SSO
sign-in for <domain> failed"` for everything else. Every thrown error is
`console.error`'d unconditionally so engineers still have the stack.
## 3. Disable Continue when the SSO is already linked to this identity
`SignInWithSso` takes a new optional `openIdCredentials` prop. In the
add-access-method flow, `AddAccessMethodWizard` passes the identity's
current credentials through; once two-hop discovery reveals the SSO's
`(iss, aud)`, a `$derived` check disables the Continue button with an
inline hint if that SSO is already linked. Mirrors how
`AddAccessMethod.svelte` already disables direct-provider buttons for
already-linked providers. Left `undefined` in the sign-in flow, where
reusing an existing credential is the point.
This makes reaching `OpenIdCredentialAlreadyRegistered` for *this*
identity impossible, so the `OpenIdCredentialAlreadyLinkedHereError`
specialization in `linkOpenIdAccount` and the corresponding toaster
branch in `handleError` are dropped as unreachable.
## 4 + 5. Move SSO domain + name from FE localStorage to
canister-stamped credential metadata
`ssoDomainStorage.ts` (a per-device localStorage map of `(iss, sub, aud)
→ domain`) is removed. The canister now stamps two new metadata keys on
any credential verified by a `DiscoverableProvider`:
- `sso_domain` — the `discovery_domain` the user entered at sign-up. The
canonical SSO label; always present for SSO credentials.
- `sso_name` — optional human-readable name from
`{domain}/.well-known/ii-openid-configuration`. When the domain
publishes `name: "DFINITY"`, the access-methods list reads "DFINITY
account" instead of "dfinity.org account".
BE:
- `IIOpenIdConfiguration` hop-1 schema gets `name: Option<String>` (with
`#[serde(default)]` so older deployments still parse).
- `DiscoverableProvider` and `DiscoveryState` carry `discovery_domain`
and a `discovered_name` ref that hop-1 populates each refresh.
- `DiscoverableProvider::verify()` inserts the two keys before returning
the credential.
FE:
- `openIdName` now resolves `sso_name` → `sso_domain` → `findConfig(iss,
aud, metadata).name`, so an SSO-via-Google credential reads as "DFINITY"
(or "dfinity.org" if the domain doesn't publish a name), not "Google".
- `openIdLogo` returns `undefined` when `sso_domain` is present (generic
SSO icon).
- `OpenIdItem.svelte` detects SSO via `sso_domain` directly, instead of
the previous "no logo found" heuristic that was brittle for
direct-provider credentials whose issuer didn't match any
`openid_configs` entry.
- `authFlow#continueWithSso` and `addAccessMethodFlow#linkSsoAccount`
both simplify — no pre-decoding the JWT or remembering the domain
locally — because the canister handles the labeling end-to-end, so the
mapping survives reloads and crosses devices.
# Tests
- `cargo test -p internet_identity --bin internet_identity`: **219/219
pass**.
- `cargo clippy --all-targets -D warnings`: clean.
- `cargo fmt --check`: clean.
- `npm run check` (tsc + svelte-check): 0 errors (19 pre-existing
warnings unchanged).
- `npm run lint` + `prettier --check`: clean.
---
[< Previous PR](dfinity#3785)
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent eb19dfe commit f07204c
35 files changed
Lines changed: 646 additions & 614 deletions
File tree
- src
- frontend/src
- lib
- components
- ui
- utils
- wizards
- addAccessMethod
- views
- auth/views
- flows
- generated
- locales
- utils
- routes/(new-styling)/manage/(authenticated)/(access-and-recovery)/access
- components
- internet_identity_interface/src/internet_identity/types
- internet_identity
- src
- openid
- storage
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
| 53 | + | |
| 54 | + | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 14 | + | |
19 | 15 | | |
20 | 16 | | |
21 | 17 | | |
| |||
32 | 28 | | |
33 | 29 | | |
34 | 30 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | 31 | | |
45 | 32 | | |
46 | | - | |
| 33 | + | |
| 34 | + | |
47 | 35 | | |
48 | 36 | | |
49 | 37 | | |
50 | | - | |
| 38 | + | |
| 39 | + | |
51 | 40 | | |
52 | 41 | | |
53 | | - | |
| 42 | + | |
54 | 43 | | |
55 | 44 | | |
56 | 45 | | |
57 | 46 | | |
58 | | - | |
| 47 | + | |
59 | 48 | | |
60 | 49 | | |
61 | 50 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
Lines changed: 84 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
23 | 34 | | |
24 | 35 | | |
25 | | - | |
| 36 | + | |
26 | 37 | | |
27 | 38 | | |
28 | 39 | | |
| |||
44 | 55 | | |
45 | 56 | | |
46 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
47 | 76 | | |
48 | 77 | | |
49 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
50 | 93 | | |
51 | 94 | | |
52 | | - | |
| 95 | + | |
53 | 96 | | |
54 | 97 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 98 | + | |
59 | 99 | | |
60 | 100 | | |
61 | 101 | | |
62 | 102 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
68 | 107 | | |
69 | | - | |
| 108 | + | |
70 | 109 | | |
71 | 110 | | |
72 | | - | |
| 111 | + | |
73 | 112 | | |
| 113 | + | |
| 114 | + | |
74 | 115 | | |
75 | 116 | | |
76 | 117 | | |
| |||
81 | 122 | | |
82 | 123 | | |
83 | 124 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | 125 | | |
100 | | - | |
| 126 | + | |
101 | 127 | | |
102 | 128 | | |
103 | | - | |
| 129 | + | |
104 | 130 | | |
105 | | - | |
106 | 131 | | |
107 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
108 | 147 | | |
109 | 148 | | |
110 | 149 | | |
| |||
160 | 199 | | |
161 | 200 | | |
162 | 201 | | |
163 | | - | |
| 202 | + | |
164 | 203 | | |
165 | 204 | | |
166 | 205 | | |
| |||
187 | 226 | | |
188 | 227 | | |
189 | 228 | | |
190 | | - | |
| 229 | + | |
191 | 230 | | |
192 | 231 | | |
193 | 232 | | |
| |||
207 | 246 | | |
208 | 247 | | |
209 | 248 | | |
210 | | - | |
| 249 | + | |
211 | 250 | | |
212 | 251 | | |
213 | 252 | | |
| |||
236 | 275 | | |
237 | 276 | | |
238 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
239 | 283 | | |
240 | 284 | | |
241 | 285 | | |
242 | 286 | | |
243 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
244 | 291 | | |
245 | 292 | | |
246 | 293 | | |
| |||
0 commit comments