Skip to content

Add JWT authentication page for NGF#1774

Open
dhurley wants to merge 1 commit intongf-release-2.5from
ngf/add-jwt-auth
Open

Add JWT authentication page for NGF#1774
dhurley wants to merge 1 commit intongf-release-2.5from
ngf/add-jwt-auth

Conversation

@dhurley
Copy link
Contributor

@dhurley dhurley commented Mar 10, 2026

Proposed changes

Checklist

Before sharing this pull request, I completed the following checklist:

Footnotes

  1. Potentially sensitive information includes personally identify information (PII), authentication credentials, and live URLs. Refer to the style guide for guidance about placeholder content.

@dhurley dhurley requested a review from a team as a code owner March 10, 2026 10:47
@github-actions github-actions bot added documentation Improvements or additions to documentation product/ngf Issues related to NGINX Gateway Fabric labels Mar 10, 2026
@github-actions
Copy link

Deploy Preview will be available once build job completes!

Name Link
😎 Deploy Preview https://frontdoor-test-docs.nginx.com/previews/docs/1774/

- **Secret type**: The secret must be of type `Opaque` with a key named `auth` containing the JWKS data in JSON format.
- **realm**: (Optional) The realm parameter sets the authentication realm displayed in the WWW-Authenticate header when authentication fails.
- **keyCache**: (Optional) Specifies how long NGINX Plus caches the JWKS keys in memory. Valid values include time units like `10s`, `1m`, `1h`. This reduces the need to re-read the secret file for each request. If not specified, keys are cached indefinitely until NGINX is reloaded.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also mention (either now or once we support remote), that this example uses File and what that means.


JWT authentication in NGINX Gateway Fabric validates JSON Web Tokens using JSON Web Key Sets (JWKS). The JWKS contains the public keys used to verify the JWT signatures. When a request arrives with a JWT in the `Authorization` header, NGINX Plus validates the token against the configured JWKS before forwarding the request to your application.

This guide demonstrates JWT authentication using a local JWKS file stored in a Kubernetes Secret.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we mention explicitly that remote JWT is excluded currently to avoid any confusion

Comment on lines +225 to +226
- **realm**: (Optional) The realm parameter sets the authentication realm displayed in the WWW-Authenticate header when authentication fails.
- **keyCache**: (Optional) Specifies how long NGINX Plus caches the JWKS keys in memory. Valid values include time units like `10s`, `1m`, `1h`. This reduces the need to re-read the secret file for each request. If not specified, keys are cached indefinitely until NGINX is reloaded.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **realm**: (Optional) The realm parameter sets the authentication realm displayed in the WWW-Authenticate header when authentication fails.
- **keyCache**: (Optional) Specifies how long NGINX Plus caches the JWKS keys in memory. Valid values include time units like `10s`, `1m`, `1h`. This reduces the need to re-read the secret file for each request. If not specified, keys are cached indefinitely until NGINX is reloaded.
- **keyCache**: (Optional) Controls how long NGINX Plus caches the JWKS keys in memory. Supported values use standard time units such as 10s, 1m, or 1h. Caching avoids reloading the JWKS from the Secret for every request, improving performance. If not specified, the keys remain cached indefinitely and are only refreshed when NGINX is reloaded.

sounds clearer I think

Copy link
Contributor

@salonichf5 salonichf5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks pretty good to me, just a couple of nits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation product/ngf Issues related to NGINX Gateway Fabric

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants