This repository was archived by the owner on Aug 21, 2024. It is now read-only.
Commit af080a2
committed
Added support for cross-domain login.
For multi-domain setups, having to log in on each different domain
is annoying. This saves the user's login information in the 'root'
domain of the deployment, and on all domains sources the login
credentials from an iframe running in the root domain using
postMessage. This only gets skipped if a user has expressly denied
cross-domain sharing of their login information, in which case
localStorage will be used as the source for login credentials.
The iframe loads a new non-vite page in client/public, and does so
in the root domain. Some user authorization flow is required on
most browsers to enable this, using the requestStorageAccess API.
A new backend service, allowed-domains, takes in a domain on a query
paramter and returns true if that domain is part of the deployment,
and a 204 if not. By default this just returns the root domain, but
this is extensible via projects' hooks to add other domains to the
allowed list. It can also just be passed a variable isAllowed from
a hook if fetching all domains would be cumbersome, and simply
querying whether the domain is in a table would be simpler.
The accessor iframe uses the response to determine
whether to even attempt to access the cookies or prompt the user
with requestStorageAccess.1 parent 3bb6b5c commit af080a2
25 files changed
Lines changed: 686 additions & 102 deletions
File tree
- packages
- client-core/src
- social/services
- user
- services
- util
- client
- public
- common/src/schemas/networking
- ecs/src
- editor/src
- components
- assets
- properties
- functions
- hyperflux/functions
- server-core/src
- hooks
- networking
- allowed-domains
- ui/src/pages/Capture
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 64 | + | |
68 | 65 | | |
69 | 66 | | |
70 | 67 | | |
| |||
Lines changed: 4 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
| |||
129 | 128 | | |
130 | 129 | | |
131 | 130 | | |
132 | | - | |
| 131 | + | |
133 | 132 | | |
134 | 133 | | |
135 | 134 | | |
136 | 135 | | |
137 | 136 | | |
138 | 137 | | |
139 | 138 | | |
140 | | - | |
| 139 | + | |
141 | 140 | | |
142 | 141 | | |
143 | 142 | | |
| |||
155 | 154 | | |
156 | 155 | | |
157 | 156 | | |
158 | | - | |
| 157 | + | |
159 | 158 | | |
160 | 159 | | |
161 | 160 | | |
| |||
170 | 169 | | |
171 | 170 | | |
172 | 171 | | |
173 | | - | |
| 172 | + | |
174 | 173 | | |
175 | 174 | | |
176 | 175 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
0 commit comments