-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoidc_idp.conf
182 lines (152 loc) · 7.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# ---------------------------------------------------------------------------- #
# #
# 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 $oidc_authz_endpoint {
default $oidc_host/auth/realms/master/protocol/openid-connect/auth;
my-client-id "http://{my-fqdn}/auth/realms/{version}/protocol/openid-connect/auth";
0oa1u2c1p0QgIiGKX5d7 $oidc_host/oauth2/default/v1/authorize;
}
map $x_client_id $oidc_jwt_keyfile {
default $oidc_host/auth/realms/master/protocol/openid-connect/certs;
my-client-id $oidc_host/auth/realms/master/protocol/openid-connect/certs;
0oa1u2c1p0QgIiGKX5d7 $oidc_host/oauth2/default/v1/keys;
}
map $x_client_id $oidc_logout_endpoint {
default $oidc_host/auth/realms/master/protocol/openid-connect/logout;
my-client-id "http://{my-fqdn}/auth/realms/{version}/protocol/openid-connect/logout";
0oa1u2c1p0QgIiGKX5d7 $oidc_host/oauth2/default/v1/logout;
}
map $x_client_id $oidc_token_endpoint {
default $oidc_host/auth/realms/master/protocol/openid-connect/token;
my-client-id "http://{my-fqdn}/auth/realms/{version}/protocol/openid-connect/token";
0oa1u2c1p0QgIiGKX5d7 $oidc_host/oauth2/default/v1/token;
}
map $x_client_id $oidc_userinfo_endpoint {
default $oidc_host/auth/realms/master/protocol/openid-connect/userinfo;
my-client-id $oidc_host/auth/realms/master/protocol/openid-connect/userinfo;
0oa1u2c1p0QgIiGKX5d7 $oidc_host/oauth2/default/v1/userinfo;
}
map $x_client_id $oidc_scopes {
default "openid+profile+email+offline_access";
my-client-id "openid+profile+email+offline_access+microprofile-jwt";
0oa1u2c1p0QgIiGKX5d7 "openid+profile+email+offline_access";
}
map $x_client_id $oidc_host {
# Examples for OIDC host:
# - Keycloak: http://host.docker.internal:8080
# - Okta https://dev-9590481.okta.com
default http://host.docker.internal:8080;
my-client-id http://host.docker.internal:8080;
0oa1u2c1p0QgIiGKX5d7 https://dev-XXXXXX.okta.com;
}
# ---------------------------------------------------------------------------- #
# 2. Custom Configuration for Well-Known OIDC Endpoints #
# ---------------------------------------------------------------------------- #
map $x_client_id $oidc_authz_path_params_enable {
default 0;
my-client-id 1;
}
map $x_client_id $oidc_authz_path_params {
default "";
my-client-id '{ "my-fqdn": "host.docker.internal:8080", "version": "master" }';
}
map $x_client_id $oidc_authz_query_params_enable {
default 0;
}
map $x_client_id $oidc_authz_query_params {
default "";
# my-client-id '{ # example: custom query param
# "response_type": "code",
# "scope" : "$oidc_scopes",
# "client_id" : "$oidc_client",
# "redirect_uri" : "$redirect_base$redir_location",
# "nonce" : "$nonce_hash",
# "state" : 0
# }';
}
map $x_client_id $oidc_logout_path_params_enable {
default 0;
my-client-id 1;
}
map $x_client_id $oidc_logout_path_params {
default "";
my-client-id '{ "my-fqdn": "host.docker.internal:8080", "version": "master" }';
}
map $x_client_id $oidc_logout_query_params_enable {
default 0; # 0: OIDC RP-initiated logout, 1: custom logout
}
map $x_client_id $oidc_logout_query_params {
default ""; # Use for when an IDP supports OIDC RP-initiated logout.
# my-client-id '{ # custom logout example w/ AWS Cognito
# "client_id" : "$oidc_client",
# "logout_uri" : "$redirect_base/_logout"
# }';
}
map $x_client_id $oidc_token_path_params_enable {
default 0;
my-client-id 1;
}
map $x_client_id $oidc_token_path_params {
default "";
my-client-id '{ "my-fqdn": "host.docker.internal:8080", "version": "master" }';
}
map $x_client_id $oidc_token_query_params_enable {
default 0;
}
map $x_client_id $oidc_token_query_params {
default "";
# my-client-id '{ "example": "data" }';
}
# ---------------------------------------------------------------------------- #
# 3. Advanced OIDC Configuration #
# ---------------------------------------------------------------------------- #
map $x_client_id $oidc_client {
default "my-client-id";
my-client-id "my-client-id";
0oa1u2c1p0QgIiGKX5d7 "0oa1u2c1p0QgIiGKX5d7";
}
map $x_client_id $oidc_client_secret {
default "my-client-secret";
my-client-id "781b60a6-8279-43dd-9cbc-cc98329ce2a7";
0oa1u2c1p0QgIiGKX5d7 "my-client-secret";
}
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
my-client-id "keycloak-hmac-key";
0oa1u2c1p0QgIiGKX5d7 "okta-pkce-hmac-0oa1u2c1p0QgIiGKX5d7";
}
map $x_client_id $oidc_pkce_enable {
default 0;
my-client-id 0;
0oa1u2c1p0QgIiGKX5d7 1;
}
map $x_client_id $oidc_app_name {
default "";
my-client-id "my-client-app";
0oa1u2c1p0QgIiGKX5d7 "my-okta-pkce-app";
}
# vim: syntax=nginx