-
Notifications
You must be signed in to change notification settings - Fork 2
/
oidc_idp.conf
163 lines (128 loc) · 5.19 KB
/
oidc_idp.conf
1
2
3
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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# ---------------------------------------------------------------------------- #
# #
# IDP Configuration for OpenID Connect #
# (within http block) | #
# | #
# http { | #
# : | #
# +--------------------------+ | #
# | include "oidc_idp.conf"; | <--+ #
# +--------------------------+ #
# : #
# server { #
# : #
# } #
# : #
# } #
# #
# - This file is to configure IDP related info to handle OIDC workflow. #
# - Each map block allows multi values so that multiple IdPs can be supported. #
# #
# ---------------------------------------------------------------------------- #
# ---------------------------------------------------------------------------- #
# 1. OpenID Provider(IDP) Metadata Configuration via Well-Known Endpoints #
# ---------------------------------------------------------------------------- #
map $x_client_id $idp_region {
default "{{Edit-IdP-Region}}"; # "us-east-2"
}
map $x_client_id $idp_domain {
default "{{Edit-IdP-Domain}}";
}
map $x_client_id $idp_user_pool_id {
default "{{Edit-User-Pool-ID}}";
}
map $x_client_id $oidc_authz_endpoint {
default https://$idp_domain/oauth2/authorize;
}
map $x_client_id $oidc_jwt_keyfile {
default https://cognito-idp.$idp_region.amazonaws.com/$idp_user_pool_id/.well-known/jwks.json;
}
map $x_client_id $oidc_logout_endpoint {
default https://$idp_domain/logout;
}
map $x_client_id $oidc_token_endpoint {
default https://$idp_domain/oauth2/token;
}
map $x_client_id $oidc_userinfo_endpoint {
default https://$idp_domain/oauth2/userInfo;
}
map $x_client_id $oidc_scopes {
default "openid+profile+email";
}
# ---------------------------------------------------------------------------- #
# 2. Custom Configuration for Well-Known OIDC Endpoints #
# ---------------------------------------------------------------------------- #
map $x_client_id $oidc_authz_path_params_enable {
default 0;
}
map $x_client_id $oidc_authz_path_params {
default "";
}
map $x_client_id $oidc_authz_query_params_enable {
default 0;
}
map $x_client_id $oidc_authz_query_params {
default "";
}
map $x_client_id $oidc_logout_path_params_enable {
default 0;
}
map $x_client_id $oidc_logout_path_params {
default "";
}
map $x_client_id $oidc_logout_query_params_enable {
default 1; # 0: OIDC RP-initiated logout, 1: custom logout
}
map $x_client_id $oidc_logout_query_params {
# custom logout example w/ AWS Cognito
# prerequisites: set the following URL in your app.
# `Allowed sign-out URLs: https://nginx.cognito.test:443/_logout`
# example 1. AWS Cognito Logout & redirect back to client.
default '{
"client_id" : "$oidc_client",
"logout_uri" : "$redirect_base/_logout"
}';
# example 2. AWS Cognito Logout & prompt an user to sign in as another user.
# default '{
# "response_type": "code",
# "client_id" : "$oidc_client",
# "redirect_uri" : "$redirect_base$redir_location",
# "state" : "STATE",
# "scope" : "$oidc_scopes"
# }';
}
map $x_client_id $oidc_token_path_params_enable {
default 0;
}
map $x_client_id $oidc_token_path_params {
default "";
}
map $x_client_id $oidc_token_query_params_enable {
default 0;
}
map $x_client_id $oidc_token_query_params {
default "";
}
# ---------------------------------------------------------------------------- #
# 3. Advanced OIDC Configuration #
# ---------------------------------------------------------------------------- #
map $x_client_id $oidc_client {
# Edit your client ID
default "{{Edit-your-client-ID}}";
}
map $x_client_id $oidc_pkce_enable {
default 1;
}
map $x_client_id $oidc_client_secret {
default "{Edit-your-client-secret-unless-pkce-enabled}";
}
map $x_client_id $oidc_logout_redirect {
default "/_logout"; # This is called by IdP after successful logout.
}
map $x_client_id $oidc_hmac_key {
default "ChangeMe"; # This should be unique for every NGINX instance/cluster
}
map $x_client_id $oidc_app_name {
default "{edit-your-idp-app-name}";
}
# vim: syntax=nginx