- Notifications
You must be signed in to change notification settings - Fork948
Commit7b06fc7
authored
refactor: simplify OAuth2 authorization flow and use 302 redirects (#18923)
# Refactor OAuth2 Provider Authorization FlowThis PR refactors the OAuth2 provider authorization flow by:1. Removing the `authorizeMW` middleware and directly implementing its functionality in the `ShowAuthorizePage` handler2. Simplifying function signatures by removing unnecessary parameters: - Removed `db` parameter from `ShowAuthorizePage` - Removed `accessURL` parameter from `ProcessAuthorize`3. Changing the redirect status code in `ProcessAuthorize` from 307 (Temporary Redirect) to 302 (Found) to improve compatibility with external OAuth2 apps and browsers. (Technical explanation: we replied with a 307 to a POST request, thus the browser performs a redirect to that URL as a POST request, but we need it to be a GET request to be compatible. Thus, we use the 302 redirect so that browsers turn it into a GET request when redirecting back to the redirect_uri.)The changes maintain the same functionality while simplifying the code and improving compatibility with external systems.1 parent071383b commit7b06fc7
File tree
4 files changed
+45
-98
lines changed- coderd
- coderdtest/oidctest
- oauth2provider
4 files changed
+45
-98
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
132 | 132 |
| |
133 | 133 |
| |
134 | 134 |
| |
135 |
| - | |
136 | 135 |
| |
137 | 136 |
| |
138 | 137 |
| |
139 | 138 |
| |
140 | 139 |
| |
141 | 140 |
| |
142 |
| - | |
| 141 | + | |
| 142 | + | |
143 | 143 |
| |
144 | 144 |
| |
145 | 145 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
116 | 116 |
| |
117 | 117 |
| |
118 | 118 |
| |
119 |
| - | |
| 119 | + | |
120 | 120 |
| |
121 | 121 |
| |
122 | 122 |
| |
| |||
131 | 131 |
| |
132 | 132 |
| |
133 | 133 |
| |
134 |
| - | |
| 134 | + | |
135 | 135 |
| |
136 | 136 |
| |
137 | 137 |
| |
|
Lines changed: 41 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
16 | 16 |
| |
17 | 17 |
| |
18 | 18 |
| |
| 19 | + | |
19 | 20 |
| |
20 | 21 |
| |
21 | 22 |
| |
| |||
67 | 68 |
| |
68 | 69 |
| |
69 | 70 |
| |
70 |
| - | |
71 |
| - | |
72 |
| - | |
73 |
| - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
74 | 105 |
| |
75 | 106 |
| |
76 | 107 |
| |
77 |
| - | |
78 |
| - | |
79 |
| - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
80 | 111 |
| |
81 | 112 |
| |
82 | 113 |
| |
| |||
159 | 190 |
| |
160 | 191 |
| |
161 | 192 |
| |
162 |
| - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
163 | 196 |
| |
164 |
| - | |
165 |
| - | |
166 |
| - | |
167 | 197 |
|
Lines changed: 0 additions & 83 deletions
This file was deleted.
0 commit comments
Comments
(0)