Commit 453b063
committed
feat(oidc): add oidc support
\# Example
1. Create OIDC app
just for the reference, gitlab_application is server wide and not ideal for use e.g. on gitlab.com, there's no support for the group applications
```tf
resource "gitlab_application" "fridges_list" {
name = "gitlab-app"
redirect_url = "www.example.com"
scopes = [
"openid",
"read_user",
"profile",
"email",
]
}
```
2. use module
```tf
module "static_site" {
source = "cookielab/static-site/aws"
version = "4.9.0"
providers = {
aws = aws
aws.us_east_1 = aws.vir
}
domains = ["www.exmaple.com"]
domain_zone_id = "aws_route53_zone.example_com.zone_id"
s3_bucket_name = "example-com-web"
gitlab_project_id = data.gitlab_project.app_fridges_list.id
gitlab_environment = var.environment
enable_deploy_role = true
enable_deploy_user = false
oidc = [
{ # first oidc provider
application_name = "gitlab"
application_id = gitlab_application.gitlab_application.application_id
client_secret = gitlab_application.gitlab_application.secret
auth_url = "https://gitlab.com/oauth/authorize"
token_url = "https://gitlab.com/oauth/token"
},
{ # second oidc provider
application_name = "second"
application_id = "second-oidc-app-id"
client_secret = "second-oidc-client-secret"
auth_url = "https://another-oidc-provicer.example.com/oauth/authorize"
token_url = "https://another-oidc-provicer.example.com/oauth/token"
}
]
```
Then https://www.example.com/?auth=APPLICATION_NAME forces auth with specified provider, e.g.:
- https://www.example.com/?auth=gitlab
- https://www.example.com/?auth=second
This is messy. Perhaps we can get along with a single OIDC auth for the application or if no session cookie is present redirect to a url hosted on s3 bucket with constructed html from the oidc list.
```
<h1>Choose authentication method</h1>
<ul>
<li>
<a href=/?auth=gitlab>gitlab</a>
</li>
<li>
<a href=/?auth=second>gitlab</a>
</li>
</ul>
```
fmt
cleanup
review: update lambda engine version nodejs18.x -> nodejs22.x
replace apigateway with lambda_function_url
update docs + fix duplicate blocks of outdated documentation due to missing BEGIN_TF_DOCS comment
review
parametrize session_duration per provider, fix cookie domain
comment sensitive log messages in lambdas1 parent 04dbf9e commit 453b063
File tree
16 files changed
+732
-119
lines changed- modules
- gitlab
- oidc
- lambda
- callback
- edge_auth
16 files changed
+732
-119
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 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 | 27 | | |
84 | 28 | | |
85 | 29 | | |
86 | 30 | | |
87 | 31 | | |
88 | 32 | | |
89 | 33 | | |
90 | | - | |
| 34 | + | |
91 | 35 | | |
92 | 36 | | |
93 | 37 | | |
94 | 38 | | |
95 | 39 | | |
96 | | - | |
97 | | - | |
| 40 | + | |
| 41 | + | |
98 | 42 | | |
99 | 43 | | |
100 | 44 | | |
101 | 45 | | |
102 | 46 | | |
103 | | - | |
| 47 | + | |
104 | 48 | | |
105 | | - | |
| 49 | + | |
| 50 | + | |
106 | 51 | | |
107 | 52 | | |
108 | 53 | | |
109 | 54 | | |
110 | 55 | | |
| 56 | + | |
111 | 57 | | |
112 | 58 | | |
113 | 59 | | |
| 60 | + | |
114 | 61 | | |
115 | 62 | | |
116 | 63 | | |
| |||
158 | 105 | | |
159 | 106 | | |
160 | 107 | | |
| 108 | + | |
161 | 109 | | |
162 | 110 | | |
163 | 111 | | |
| |||
182 | 130 | | |
183 | 131 | | |
184 | 132 | | |
| 133 | + | |
185 | 134 | | |
186 | | - | |
| 135 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
235 | 280 | | |
236 | 281 | | |
237 | 282 | | |
| |||
243 | 288 | | |
244 | 289 | | |
245 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
246 | 307 | | |
247 | 308 | | |
248 | 309 | | |
| |||
265 | 326 | | |
266 | 327 | | |
267 | 328 | | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
274 | 342 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
280 | 349 | | |
281 | 350 | | |
282 | 351 | | |
| |||
289 | 358 | | |
290 | 359 | | |
291 | 360 | | |
292 | | - | |
| 361 | + | |
293 | 362 | | |
294 | 363 | | |
295 | 364 | | |
| |||
298 | 367 | | |
299 | 368 | | |
300 | 369 | | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
301 | 379 | | |
302 | 380 | | |
303 | 381 | | |
| |||
321 | 399 | | |
322 | 400 | | |
323 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
324 | 421 | | |
325 | 422 | | |
326 | 423 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 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 | 5 | | |
47 | 6 | | |
48 | 7 | | |
49 | 8 | | |
50 | 9 | | |
51 | 10 | | |
52 | 11 | | |
53 | | - | |
| 12 | + | |
54 | 13 | | |
55 | 14 | | |
56 | 15 | | |
57 | 16 | | |
58 | 17 | | |
59 | | - | |
| 18 | + | |
60 | 19 | | |
61 | 20 | | |
62 | 21 | | |
| |||
95 | 54 | | |
96 | 55 | | |
97 | 56 | | |
98 | | - | |
| 57 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
0 commit comments