File tree Expand file tree Collapse file tree 4 files changed +39
-1
lines changed Expand file tree Collapse file tree 4 files changed +39
-1
lines changed Original file line number Diff line number Diff line change
1
+ {% if openidc_enabled -%}
2
+ access_by_lua_block {
3
+ local openidc = require("resty.openidc")
4
+ local opts = {
5
+ redirect_uri = "{{- openidc_redirect_uri -}}",
6
+ discovery = "{{- openidc_discovery -}}",
7
+ token_endpoint_auth_method = "{{- openidc_auth_method -}}",
8
+ client_id = "{{- openidc_client_id -}}",
9
+ client_secret = "{{- openidc_client_secret -}}",
10
+ scope = "openid email profile"
11
+ }
12
+
13
+ local res, err = openidc.authenticate(opts)
14
+
15
+ if err then
16
+ ngx.status = 500
17
+ ngx.say(err)
18
+ ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
19
+ end
20
+
21
+
22
+ ngx.req.set_header("X-OIDC-SUB", res.id_token.sub)
23
+ ngx.req.set_header("X-OIDC-EMAIL", res.id_token.email)
24
+ ngx.req.set_header("X-OIDC-NAME", res.id_token.name)
25
+ }
26
+ {% endif %}
Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ server {
39
39
40
40
{% endif %}
41
41
42
+ {% include "_openid_connect.conf" %}
43
+
42
44
{% include "_forced_ssl.conf" %}
43
45
{% include "_hsts.conf" %}
44
46
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ WORKDIR /app
38
38
RUN yarn install
39
39
40
40
# Remove frontend service not required for prod, dev nginx config as well
41
- RUN rm -rf /etc/services.d/frontend RUN rm -f /etc/nginx/conf.d/dev.conf
41
+ RUN rm -rf /etc/services.d/frontend && rm -f /etc/nginx/conf.d/dev.conf
42
42
43
43
VOLUME [ "/data" , "/etc/letsencrypt" ]
44
44
CMD [ "/init" ]
Original file line number Diff line number Diff line change @@ -43,6 +43,16 @@ http {
43
43
proxy_cache_path /var/lib/nginx/cache/public levels=1:2 keys_zone=public-cache:30m max_size=192m;
44
44
proxy_cache_path /var/lib/nginx/cache/private levels=1:2 keys_zone=private-cache:5m max_size=1024m;
45
45
46
+ lua_package_path '~/lua/?.lua;;' ;
47
+
48
+ lua_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt;
49
+ lua_ssl_verify_depth 5;
50
+
51
+ # cache for discovery metadata documents
52
+ lua_shared_dict discovery 1m ;
53
+ # cache for JWKs
54
+ lua_shared_dict jwks 1m ;
55
+
46
56
log_format proxy '[$time_local ] $upstream_cache_status $upstream_status $status - $request_method $scheme $host "$request_uri " [Client $remote_addr ] [Length $body_bytes_sent ] [Gzip $gzip_ratio ] [Sent-to $server ] "$http_user_agent " "$http_referer "' ;
47
57
log_format standard '[$time_local ] $status - $request_method $scheme $host "$request_uri " [Client $remote_addr ] [Length $body_bytes_sent ] [Gzip $gzip_ratio ] "$http_user_agent " "$http_referer "' ;
48
58
You can’t perform that action at this time.
0 commit comments