Commit 568e8ec
committed
refactor(server): extract the device authorization endpoints into a package
Move the browser-facing side of the OAuth2 device flow (RFC 8628) out of the
god Server into a server/device package: the /device user-code page,
/device/code authorization request, /device/auth/verify_code verification, and
the /device/callback that completes the flow. The handler mounts its own routes
and holds only its dependencies (storage, templates, issuer URL, timing, logger)
plus the shared ExchangeAuthCode and a RenderError callback.
The device_code token grant stays with the token endpoint: it is a /token grant
like the others, dispatched from handleToken, so the token endpoint keeps
owning it rather than the server reaching into the device handler. The
deprecated /device/token endpoint stays alongside it.
The PKCE code-challenge method names move to the oauth2 package as
PKCEMethodPlain/PKCEMethodS256. No behaviour change.
Signed-off-by: maksim.nabokikh <max.nabokih@gmail.com>1 parent cf4ab8b commit 568e8ec
10 files changed
Lines changed: 449 additions & 407 deletions
Large diffs are not rendered by default.
| 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 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | 19 | | |
42 | 20 | | |
43 | 21 | | |
| |||
135 | 113 | | |
136 | 114 | | |
137 | 115 | | |
138 | | - | |
| 116 | + | |
139 | 117 | | |
140 | 118 | | |
141 | 119 | | |
| |||
0 commit comments