|
1 | 1 | # Advanced configuration START |
2 | 2 | set $internal_error_message "NGINX / OpenID Connect login failure\n"; |
3 | 3 | set $pkce_id ""; |
4 | | - set $idp_sid ""; |
5 | 4 | # resolver 8.8.8.8; # For DNS lookup of IdP endpoints; |
6 | 5 | subrequest_output_buffer_size 32k; # To fit a complete tokenset response |
7 | 6 | gunzip on; # Decompress IdP responses if necessary |
|
38 | 37 | # to construct the OpenID Connect token request, as per: |
39 | 38 | # http://openid.net/specs/openid-connect-core-1_0.html#TokenRequest |
40 | 39 | internal; |
41 | | - |
42 | | - # Exclude client headers to avoid CORS errors with certain IdPs (e.g., Microsoft Entra ID) |
43 | | - proxy_pass_request_headers off; |
44 | | - |
45 | 40 | proxy_ssl_server_name on; # For SNI to the IdP |
46 | 41 | proxy_set_header Content-Type "application/x-www-form-urlencoded"; |
47 | 42 | proxy_set_header Authorization $arg_secret_basic; |
48 | 43 | proxy_pass $oidc_token_endpoint; |
49 | | - } |
| 44 | + } |
50 | 45 |
|
51 | 46 | location = /_refresh { |
52 | 47 | # This location is called by oidcAuth() when performing a token refresh. We |
53 | 48 | # use the proxy_ directives to construct the OpenID Connect token request, as per: |
54 | 49 | # https://openid.net/specs/openid-connect-core-1_0.html#RefreshingAccessToken |
55 | 50 | internal; |
56 | | - |
57 | | - # Exclude client headers to avoid CORS errors with certain IdPs (e.g., Microsoft Entra ID) |
58 | | - proxy_pass_request_headers off; |
59 | | - |
60 | 51 | proxy_ssl_server_name on; # For SNI to the IdP |
61 | 52 | proxy_set_header Content-Type "application/x-www-form-urlencoded"; |
62 | 53 | proxy_set_header Authorization $arg_secret_basic; |
63 | 54 | proxy_pass $oidc_token_endpoint; |
64 | 55 | } |
65 | 56 |
|
66 | | - location = /_token_validation { |
| 57 | + location = /_id_token_validation { |
67 | 58 | # This location is called by oidcCodeExchange() and oidcRefreshRequest(). We use |
68 | 59 | # the auth_jwt_module to validate the OpenID Connect token response, as per: |
69 | 60 | # https://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation |
70 | 61 | internal; |
71 | 62 | auth_jwt "" token=$arg_token; |
72 | | - js_content oidc.extractTokenClaims; |
| 63 | + js_content oidc.validateIdToken; |
73 | 64 | error_page 500 502 504 @oidc_error; |
74 | 65 | } |
75 | 66 |
|
76 | | - location = /front_channel_logout { |
77 | | - status_zone "OIDC logout"; |
78 | | - add_header Cache-Control "no-store"; |
79 | | - default_type text/plain; |
80 | | - js_content oidc.handleFrontChannelLogout; |
81 | | - } |
82 | | - |
83 | 67 | location = /logout { |
84 | 68 | status_zone "OIDC logout"; |
85 | 69 | add_header Set-Cookie "auth_token=; $oidc_cookie_flags"; |
|
0 commit comments