You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/nginx/deployment-guides/single-sign-on/active-directory-federation-services.md
+73-15Lines changed: 73 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,14 +11,14 @@ nd-docs: DOCS-1683
11
11
12
12
This guide explains how to enable single sign-on (SSO) for applications being proxied by F5 NGINX Plus. The solution uses OpenID Connect as the authentication mechanism, with [Microsoft Active Directory Federation Services](https://docs.microsoft.com/en-us/windows-server/identity/active-directory-federation-services) (AD FS) as the Identity Provider (IdP) and NGINX Plus as the Relying Party (RP), or OIDC client application that verifies user identity.
13
13
14
-
{{< call-out "note" >}} This guide applies to [NGINX Plus Release 34]({{< ref "nginx/releases.md#r34" >}}) and later. In earlier versions, NGINX Plus relied on an [njs-based solution](#legacy-njs-guide), which required NGINX JavaScript files, key-value stores, and advanced OpenID Connect logic. In the latest NGINX Plus version, the new [OpenID Connect module](https://nginx.org/en/docs/http/ngx_http_oidc_module.html) simplifies this process to just a few directives.{{< /call-out >}}
14
+
{{< call-out "note" >}} This guide applies to [NGINX Plus Release 35]({{< ref "nginx/releases.md#r35" >}}) and later. In earlier versions, NGINX Plus relied on an [njs-based solution](#legacy-njs-guide), which required NGINX JavaScript files, key-value stores, and advanced OpenID Connect logic. In the latest NGINX Plus version, the new [OpenID Connect module](https://nginx.org/en/docs/http/ngx_http_oidc_module.html) simplifies this process to just a few directives.{{< /call-out >}}
15
15
16
16
17
17
## Prerequisites
18
18
19
19
- A Microsoft AD FS instance, either on-premises or in [Azure](https://learn.microsoft.com/en-us/windows-server/identity/ad-fs/deployment/how-to-connect-fed-azure-adfs), with administrator privileges.
20
20
21
-
- An NGINX Plus [subscription](https://www.f5.com/products/nginx/nginx-plus) and NGINX Plus [Release 34](({{< ref "nginx/releases.md#r34" >}})) or later. For installation instructions, see [Installing NGINX Plus](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-plus/).
21
+
- An NGINX Plus [subscription](https://www.f5.com/products/nginx/nginx-plus) and NGINX Plus [Release 35](({{< ref "nginx/releases.md#r35" >}})) or later. For installation instructions, see [Installing NGINX Plus](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-plus/).
22
22
23
23
- A domain name pointing to your NGINX Plus instance, for example, `demo.example.com`.
24
24
@@ -57,6 +57,18 @@ This guide explains how to enable single sign-on (SSO) for applications being pr
57
57
58
58
- Select **Next** to complete the steps for adding the application group.
59
59
60
+
### Configure Logout URLs
61
+
62
+
After creating the application group, you need to configure the logout URLs to support RP-initiated logout:
63
+
64
+
1. In **AD FS Management**, navigate to **Application Groups** and select your application group.
65
+
66
+
2. Right-click on the application group and select **Properties**.
67
+
68
+
3. In the **Properties** dialog, add the post logout redirect URI to the application configuration:
69
+
70
+
- Add the post logout URL, for example: `https://demo.example.com/post_logout/`.
71
+
60
72
### Get the OpenID Connect Discovery URL
61
73
62
74
Check the OpenID Connect endpoint URL. By default, AD FS publishes the `.well-known/openid-configuration` document at the following address:
@@ -86,6 +98,8 @@ Check the OpenID Connect endpoint URL. By default, AD FS publishes the `.well-kn
@@ -101,18 +115,18 @@ Check the OpenID Connect endpoint URL. By default, AD FS publishes the `.well-kn
101
115
102
116
## Set up NGINX Plus {#nginx-plus-setup}
103
117
104
-
With AF DS configured, you can enable OIDC on NGINX Plus. NGINX Plus serves as the Rely Party (RP) application — a client service that verifies user identity.
118
+
With AD FS configured, you can enable OIDC on NGINX Plus. NGINX Plus serves as the Rely Party (RP) application — a client service that verifies user identity.
105
119
106
120
107
121
1. Ensure that you are using the latest version of NGINX Plus by running the `nginx -v` command in a terminal:
108
122
109
123
```shell
110
124
nginx -v
111
125
```
112
-
The output should match NGINX Plus Release 34 or later:
126
+
The output should match NGINX Plus Release 35 or later:
113
127
114
128
```none
115
-
nginx version: nginx/1.27.4 (nginx-plus-r34)
129
+
nginx version: nginx/1.29.0 (nginx-plus-r35)
116
130
```
117
131
118
132
2. Ensure that you have the values of the **Client ID**, **Client Secret**, and **Issuer** obtained during [AD FS Configuration](#adfs-setup).
@@ -154,16 +168,29 @@ With AF DS configured, you can enable OIDC on NGINX Plus. NGINX Plus serves as t
154
168
155
169
The `issuer` is typically your AD FS OIDC URL. By default, NGINX forms the provider metadata endpoint by appending `.well-known/openid-configuration` to the issuer. For AD FS, this often resolves to `https://adfs-server-address/adfs/.well-known/openid-configuration`. If your AD FS issuer differs from `https://adfs-server-address/adfs` (for example, a custom path), you can explicitly specify the metadata document with the [`config_url`](https://nginx.org/en/docs/http/ngx_http_oidc_module.html#config_url) directive.
156
170
157
-
- **Important:** All interaction with the IdP is secured exclusively over SSL/TLS, so NGINX must trust the certificate presented by the IdP. By default, this trust is validated against your system’s CA bundle (the default CA store foryour Linux or FreeBSD distribution). If the IdP’s certificate is not includedin the system CA bundle, you can explicitly specify a trusted certificate or chain with the [`ssl_trusted_certificate`](https://nginx.org/en/docs/http/ngx_http_oidc_module.html#ssl_trusted_certificate) directive so that NGINX can validate and trust the IdP’s certificate.
171
+
- The **logout_uri** is URI that a user visits to start an RP‑initiated logout flow.
172
+
173
+
- The **post_logout_uri** is absolute HTTPS URL where AD FS should redirect the user after a successful logout. This value **must also be configured**in the AD FS application properties.
174
+
175
+
- If the **logout_token_hint** directive set to `on`, NGINX Plus sends the user's ID token as a *hint* to AD FS.
176
+
This directive is **optional**, however, if it is omitted the AD FS may display an extra confirmation page asking the user to approve the logout request.
177
+
178
+
- If the **userinfo** directive is set to `on`, NGINX Plus will fetch `/userinfo` from the AD FS and append the claims from userinfo to the `$oidc_claims_` variables.
179
+
180
+
- **Important:** All interaction with the IdP is secured exclusively over SSL/TLS, so NGINX must trust the certificate presented by the IdP. By default, this trust is validated against your system's CA bundle (the default CA store foryour Linux or FreeBSD distribution). If the IdP's certificate is not includedin the system CA bundle, you can explicitly specify a trusted certificate or chain with the [`ssl_trusted_certificate`](https://nginx.org/en/docs/http/ngx_http_oidc_module.html#ssl_trusted_certificate) directive so that NGINX can validate and trust the IdP's certificate.
@@ -195,7 +222,7 @@ With AF DS configured, you can enable OIDC on NGINX Plus. NGINX Plus serves as t
195
222
}
196
223
```
197
224
198
-
8. Protect this [location](https://nginx.org/en/docs/http/ngx_http_core_module.html#location) with AD FS OIDC by specifying the [`auth_oidc`](https://nginx.org/en/docs/http/ngx_http_oidc_module.html#auth_oidc) directive that will point to the `afds` configuration specified in the [`oidc_provider {}`](https://nginx.org/en/docs/http/ngx_http_oidc_module.html#oidc_provider) context in [Step 5](#adfs-setup-oidc-provider):
225
+
8. Protect this [location](https://nginx.org/en/docs/http/ngx_http_core_module.html#location) with AD FS OIDC by specifying the [`auth_oidc`](https://nginx.org/en/docs/http/ngx_http_oidc_module.html#auth_oidc) directive that will point to the `adfs` configuration specified in the [`oidc_provider {}`](https://nginx.org/en/docs/http/ngx_http_oidc_module.html#oidc_provider) context in [Step 5](#adfs-setup-oidc-provider):
199
226
200
227
```nginx
201
228
# ...
@@ -237,7 +264,18 @@ With AF DS configured, you can enable OIDC on NGINX Plus. NGINX Plus serves as t
237
264
```
238
265
239
266
<span id="oidc_app"></span>
240
-
10. Create a simple test application referenced by the `proxy_pass` directive which returns the authenticated user's full name and email upon successful authentication:
267
+
10. Provide endpoint for completing logout:
268
+
269
+
```nginx
270
+
# ...
271
+
location /post_logout/ {
272
+
return 200 "You have been logged out.\n";
273
+
default_type text/plain;
274
+
}
275
+
# ...
276
+
```
277
+
278
+
11. Create a simple test application referenced by the `proxy_pass` directive which returns the authenticated user's full name and email upon successful authentication:
241
279
242
280
```nginx
243
281
# ...
@@ -250,7 +288,7 @@ With AF DS configured, you can enable OIDC on NGINX Plus. NGINX Plus serves as t
250
288
}
251
289
}
252
290
```
253
-
11. Save the NGINX configuration file and reload the configuration:
291
+
12. Save the NGINX configuration file and reload the configuration:
254
292
```nginx
255
293
nginx -s reload
256
294
```
@@ -273,6 +311,14 @@ http {
273
311
# Replace with your actual AD FS Client ID and Secret
1. Open `https://demo.example.com/`in a browser. You will be automatically redirected to the AD FS sign-in page.
312
364
313
-
2. Enter valid AD FS credentials of a user who has access the application. Upon successful sign-in, AD FS redirects you back to NGINX Plus, and you will see the proxied application content (for example, “Hello, Jane Doe!”).
365
+
2. Enter valid AD FS credentials of a user who has access the application. Upon successful sign-in, AD FS redirects you back to NGINX Plus, and you will see the proxied application content (for example, "Hello, Jane Doe!").
366
+
367
+
3. Navigate to `https://demo.example.com/logout`. NGINX Plus initiates an RP‑initiated logout; AD FS ends the session and redirects back to `https://demo.example.com/post_logout/`.
368
+
369
+
4. Refresh `https://demo.example.com/` again. You should be redirected to AD FS for a fresh sign‑in, proving the session has been terminated.
314
370
315
371
316
372
## Legacy njs-based AD FS Solution {#legacy-njs-guide}
@@ -322,9 +378,11 @@ If you are running NGINX Plus R33 and earlier or if you still need the njs-based
322
378
323
379
- [NGINX Plus Native OIDC Module Reference documentation](https://nginx.org/en/docs/http/ngx_http_oidc_module.html)
324
380
325
-
- [Release Notes for NGINX Plus R34]({{< ref "nginx/releases.md#r34" >}})
381
+
- [Release Notes for NGINX Plus R35]({{< ref "nginx/releases.md#r35">}})
326
382
327
383
328
384
## Revision History
329
385
330
-
- Version 1 (March 2025) – Initial version (NGINX Plus Release 34)
386
+
- Version 2 (August 2025) – Added RP‑initiated logout (logout_uri, post_logout_uri, logout_token_hint) and userinfo support.
387
+
388
+
- Version 1 (March 2025) – Initial version (NGINX Plus Release 34)
0 commit comments