-
Notifications
You must be signed in to change notification settings - Fork 340
Usage of JWKS with JWT (without using OpenID connect) #5578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
shikharj05
merged 46 commits into
opensearch-project:main
from
Rishav9852Kumar:jwt-auth-with-jwks
Sep 26, 2025
Merged
Usage of JWKS with JWT (without using OpenID connect) #5578
shikharj05
merged 46 commits into
opensearch-project:main
from
Rishav9852Kumar:jwt-auth-with-jwks
Sep 26, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
762b1ac to
d1329ff
Compare
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5578 +/- ##
==========================================
+ Coverage 72.85% 72.99% +0.14%
==========================================
Files 413 414 +1
Lines 25758 25840 +82
Branches 3917 3933 +16
==========================================
+ Hits 18767 18863 +96
+ Misses 5073 5063 -10
+ Partials 1918 1914 -4
🚀 New features to boost your workflow:
|
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
cwperks
reviewed
Sep 23, 2025
Rishav9852Kumar
commented
Sep 24, 2025
...main/java/org/opensearch/security/auth/http/jwt/keybyjwks/HTTPJwtKeyByJWKSAuthenticator.java
Show resolved
Hide resolved
cwperks
reviewed
Sep 24, 2025
src/main/java/org/opensearch/security/securityconf/DynamicConfigModelV7.java
Outdated
Show resolved
Hide resolved
cwperks
reviewed
Sep 24, 2025
cwperks
reviewed
Sep 24, 2025
src/test/java/org/opensearch/security/auth/http/jwt/keybyoidc/KeySetRetrieverTest.java
Outdated
Show resolved
Hide resolved
Member
|
@Rishav9852Kumar Thank you for this thorough PR with associated documentation on testing. Left a few comments, but mostly looks good and well documented in the code. |
Rishav9852Kumar
commented
Sep 25, 2025
...main/java/org/opensearch/security/auth/http/jwt/keybyjwks/HTTPJwtKeyByJWKSAuthenticator.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
Signed-off-by: Rishav Kumar <rishavaz@amazon.com>
shikharj05
reviewed
Sep 26, 2025
...main/java/org/opensearch/security/auth/http/jwt/keybyjwks/HTTPJwtKeyByJWKSAuthenticator.java
Show resolved
Hide resolved
cwperks
approved these changes
Sep 26, 2025
shikharj05
approved these changes
Sep 26, 2025
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR implements direct JWKS (JSON Web Key Set) support in the JWT authentication backend by adding a new HTTPJwtKeyByJWKSAuthenticator class. This enables JWT authentication with JWKS endpoints without requiring OIDC infrastructure coupling.
EnhancementWhy these changes are required?
JWKS support currently exists only through the
HTTPJwtKeyByOpenIdConnectAuthenticatorwhich requires OIDC discovery (openid_connect_url). This creates unnecessary coupling between JWT authentication and OIDC infrastructure. This enhancement addresses:openid_connect_urlwhen only JWKS is requiredWhat is the old behavior before changes and new behavior after changes?
Old Behavior:
jwt-key-by-oidctype (OIDC authenticator)openid_connect_urlfor OIDC discovery ORjwks_urithrough OIDC backendNew Behavior:
jwks_uriinjwt_auth_domain configIssues Resolved
#4974
Implementation Details
HTTPJwtKeyByJWKSAuthenticator: New authenticator extending
AbstractHTTPJwtAuthenticatorConfiguration parameters:
jwks_uri: JWKS endpoint URL (required)cache_jwks_endpoint: Enable caching (default: true)jwks_request_timeout_ms: HTTP timeout (default: 5000ms)jwks_queued_thread_timeout_ms: Thread timeout (default: 2500ms)Architecture:
AbstractHTTPJwtAuthenticatorinfrastructureKeyProviderinterface andSelfRefreshingKeySetfor consistencykid-based key selection as OIDC authenticatorKey Features:
Testing
Unit Tests added
Added in
KeySetRetrieverTest.javaAdded in
HTTPJwtKeyByJWKSAuthenticatorTest.javaref : https://github.com/Rishav9852Kumar/sample/blob/main/Steps%20to%20validate%20JWT%20auth%20using%20JWKS%20endpoint.pdf
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.