Skip to content

Commit fba154b

Browse files
authored
Update OIDC deployment guides to reflect R35 capabilities. (#952)
Authored-by: Ivan Ovchinnikov <[email protected]> Authored-by: Ivan Ovchinnikov <[email protected]>
1 parent ebc5bf4 commit fba154b

File tree

8 files changed

+752
-168
lines changed

8 files changed

+752
-168
lines changed

content/nginx/deployment-guides/single-sign-on/active-directory-federation-services.md

Lines changed: 73 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ nd-docs: DOCS-1683
1111

1212
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.
1313

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 >}}
1515

1616

1717
## Prerequisites
1818

1919
- 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.
2020

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/).
2222

2323
- A domain name pointing to your NGINX Plus instance, for example, `demo.example.com`.
2424

@@ -57,6 +57,18 @@ This guide explains how to enable single sign-on (SSO) for applications being pr
5757

5858
- Select **Next** to complete the steps for adding the application group.
5959

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+
6072
### Get the OpenID Connect Discovery URL
6173

6274
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
8698
"authorization_endpoint": "https://adfs-server-address/adfs/oauth2/authorize/",
8799
"token_endpoint": "https://adfs-server-address/adfs/oauth2/token/",
88100
"jwks_uri": "https://adfs-server-address/adfs/discovery/keys",
101+
"userinfo_endpoint": "https://adfs-server-address/adfs/userinfo",
102+
"end_session_endpoint": "https://adfs-server-address/adfs/oauth2/logout",
89103
...
90104
}
91105
```
@@ -101,18 +115,18 @@ Check the OpenID Connect endpoint URL. By default, AD FS publishes the `.well-kn
101115

102116
## Set up NGINX Plus {#nginx-plus-setup}
103117

104-
With AF DS configured, you can enable OIDC on NGINX Plus. NGINX Plus serves as the Rely Party (RP) application &mdash; 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 &mdash; a client service that verifies user identity.
105119

106120

107121
1. Ensure that you are using the latest version of NGINX Plus by running the `nginx -v` command in a terminal:
108122

109123
```shell
110124
nginx -v
111125
```
112-
The output should match NGINX Plus Release 34 or later:
126+
The output should match NGINX Plus Release 35 or later:
113127

114128
```none
115-
nginx version: nginx/1.27.4 (nginx-plus-r34)
129+
nginx version: nginx/1.29.0 (nginx-plus-r35)
116130
```
117131

118132
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
154168

155169
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.
156170

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 for your Linux or FreeBSD distribution). If the IdP’s certificate is not included in 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 for your Linux or FreeBSD distribution). If the IdP's certificate is not included in 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.
158181
159182
```nginx
160183
http {
161184
resolver 10.0.0.1 ipv4=on valid=300s;
162185
163186
oidc_provider adfs {
164-
issuer https://adfs.example.com/adfs;
165-
client_id <client_id>;
166-
client_secret <client_secret>;
187+
issuer https://adfs.example.com/adfs;
188+
client_id <client_id>;
189+
client_secret <client_secret>;
190+
logout_uri /logout;
191+
post_logout_uri https://demo.example.com/post_logout/;
192+
logout_token_hint on;
193+
userinfo on;
167194
}
168195
169196
# ...
@@ -195,7 +222,7 @@ With AF DS configured, you can enable OIDC on NGINX Plus. NGINX Plus serves as t
195222
}
196223
```
197224
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):
199226
200227
```nginx
201228
# ...
@@ -237,7 +264,18 @@ With AF DS configured, you can enable OIDC on NGINX Plus. NGINX Plus serves as t
237264
```
238265
239266
<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:
241279

242280
```nginx
243281
# ...
@@ -250,7 +288,7 @@ With AF DS configured, you can enable OIDC on NGINX Plus. NGINX Plus serves as t
250288
}
251289
}
252290
```
253-
11. Save the NGINX configuration file and reload the configuration:
291+
12. Save the NGINX configuration file and reload the configuration:
254292
```nginx
255293
nginx -s reload
256294
```
@@ -273,6 +311,14 @@ http {
273311
# Replace with your actual AD FS Client ID and Secret
274312
client_id <client_id>;
275313
client_secret <client_secret>;
314+
315+
# RP‑initiated logout
316+
logout_uri /logout;
317+
post_logout_uri https://demo.example.com/post_logout/;
318+
logout_token_hint on;
319+
320+
# Fetch userinfo claims
321+
userinfo on;
276322
}
277323
278324
server {
@@ -293,9 +339,15 @@ http {
293339
294340
proxy_pass http://127.0.0.1:8080;
295341
}
342+
343+
location /post_logout/ {
344+
return 200 "You have been logged out.\n";
345+
default_type text/plain;
346+
}
296347
}
297348
298349
server {
350+
# Simple test upstream server
299351
listen 8080;
300352
301353
location / {
@@ -310,7 +362,11 @@ http {
310362

311363
1. Open `https://demo.example.com/` in a browser. You will be automatically redirected to the AD FS sign-in page.
312364

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.
314370

315371

316372
## 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
322378

323379
- [NGINX Plus Native OIDC Module Reference documentation](https://nginx.org/en/docs/http/ngx_http_oidc_module.html)
324380

325-
- [Release Notes for NGINX Plus R34]({{< ref "nginx/releases.md#r34" >}})
381+
- [Release Notes for NGINX Plus R35]({{< ref "nginx/releases.md#r35" >}})
326382

327383

328384
## Revision History
329385

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

Comments
 (0)