-
Notifications
You must be signed in to change notification settings - Fork 340
[FEATURE] usage of JWKS with JWT (w/o OpenID connect) #2808
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
[FEATURE] usage of JWKS with JWT (w/o OpenID connect) #2808
Conversation
Signed-off-by: Sebastian Michalski <shekerama@gmail.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
|
|
||
| KeySetRetriever keySetRetriever = new KeySetRetriever(settings.get("openid_connect_url"), | ||
| getSSLConfig(settings, configPath), settings.getAsBoolean("cache_jwks_endpoint", false)); | ||
| var jwksUri = settings.get("jwks_uri"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want strongly typed where possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched this to String
| static final JwtToken MC_COY_EXPIRED = create(MCCOY_SUBJECT, TEST_AUDIENCE, ROLES_CLAIM, TEST_ROLES_STRING, JwtConstants.CLAIM_EXPIRY, 10); | ||
| static final JwtToken MC_COY = create(MCCOY_SUBJECT, TEST_AUDIENCE, TEST_ISSUER, ROLES_CLAIM, TEST_ROLES_STRING); | ||
|
|
||
| static final JwtToken MC_COY_2 = create(MCCOY_SUBJECT, TEST_AUDIENCE, TEST_ISSUER, ROLES_CLAIM, TEST_ROLES_STRING); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you make a second identical token? It does not look it is every compared to MC_COY so it seems like any tests using MC_COY_SIGNED_OCT_2 could just use MC_COY_SIGNED_OCT_1? Perhaps I am misreading things?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the intention was that it was signed with a larger octet key, but it was not being configured correctly down below. I updated it now to ensure its using TestJwk.OCT_2 as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These Jwks are originally used for SelfRefreshingKeySetTest and are being re-purposed for these tests.
DarshitChanpura
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we close the other PR then?
Signed-off-by: Craig Perkins <cwperx@amazon.com>
|
@DarshitChanpura Yes, the other PR should be closed unless there are any substantial changes requested in the review. |
|
Looking at the test failures |
Signed-off-by: Craig Perkins <cwperx@amazon.com>
|
I just pushed a fix for the tests. There were 2 issues:
|
|
Looks like the tests are still failing😥. |
Signed-off-by: Craig Perkins <cwperx@amazon.com>
|
@DarshitChanpura I pushed another commit to fix tests. I created more TestJwts to make it more obvious what the usage of each TestJwt was by giving them a clearer name which resembles the test case they are used for. |
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Codecov Report
@@ Coverage Diff @@
## main #2808 +/- ##
============================================
+ Coverage 61.48% 61.61% +0.12%
- Complexity 3401 3413 +12
============================================
Files 266 266
Lines 18865 18893 +28
Branches 3302 3305 +3
============================================
+ Hits 11599 11640 +41
+ Misses 5669 5656 -13
Partials 1597 1597
|
* [FEATURE] usage of JWKS with JWT (w/o OpenID connect) Signed-off-by: Sebastian Michalski <shekerama@gmail.com> * Change issuer to audience Signed-off-by: Craig Perkins <cwperx@amazon.com> * Switch to OCT_2 and use String instead of var Signed-off-by: Craig Perkins <cwperx@amazon.com> * Only check required issuer and required audience if set Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix test cases Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove unused import Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Sebastian Michalski <shekerama@gmail.com> Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Sebastian Michalski <shekerama@gmail.com> (cherry picked from commit 4b38671)
* [FEATURE] usage of JWKS with JWT (w/o OpenID connect) Signed-off-by: Sebastian Michalski <shekerama@gmail.com> * Change issuer to audience Signed-off-by: Craig Perkins <cwperx@amazon.com> * Switch to OCT_2 and use String instead of var Signed-off-by: Craig Perkins <cwperx@amazon.com> * Only check required issuer and required audience if set Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix test cases Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove unused import Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Sebastian Michalski <shekerama@gmail.com> Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Sebastian Michalski <shekerama@gmail.com> (cherry picked from commit 4b38671)
* [FEATURE] usage of JWKS with JWT (w/o OpenID connect) --------- Signed-off-by: Sebastian Michalski <shekerama@gmail.com> Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Sebastian Michalski <shekerama@gmail.com> (cherry picked from commit 4b38671) Co-authored-by: Craig Perkins <cwperx@amazon.com>
* [FEATURE] usage of JWKS with JWT (w/o OpenID connect) Signed-off-by: Sebastian Michalski <shekerama@gmail.com> * Change issuer to audience Signed-off-by: Craig Perkins <cwperx@amazon.com> * Switch to OCT_2 and use String instead of var Signed-off-by: Craig Perkins <cwperx@amazon.com> * Only check required issuer and required audience if set Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix test cases Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove unused import Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Sebastian Michalski <shekerama@gmail.com> Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Sebastian Michalski <shekerama@gmail.com> (cherry picked from commit 4b38671) Co-authored-by: Craig Perkins <cwperx@amazon.com>
…ject#2808) * [FEATURE] usage of JWKS with JWT (w/o OpenID connect) Signed-off-by: Sebastian Michalski <shekerama@gmail.com> * Change issuer to audience Signed-off-by: Craig Perkins <cwperx@amazon.com> * Switch to OCT_2 and use String instead of var Signed-off-by: Craig Perkins <cwperx@amazon.com> * Only check required issuer and required audience if set Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix test cases Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove unused import Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Sebastian Michalski <shekerama@gmail.com> Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Sebastian Michalski <shekerama@gmail.com>
…ject#2808) * [FEATURE] usage of JWKS with JWT (w/o OpenID connect) Signed-off-by: Sebastian Michalski <shekerama@gmail.com> * Change issuer to audience Signed-off-by: Craig Perkins <cwperx@amazon.com> * Switch to OCT_2 and use String instead of var Signed-off-by: Craig Perkins <cwperx@amazon.com> * Only check required issuer and required audience if set Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix test cases Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove unused import Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Sebastian Michalski <shekerama@gmail.com> Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Sebastian Michalski <shekerama@gmail.com> Signed-off-by: Maciej Mierzwa <dev.maciej.mierzwa@gmail.com>
…ject#2808) * [FEATURE] usage of JWKS with JWT (w/o OpenID connect) Signed-off-by: Sebastian Michalski <shekerama@gmail.com> * Change issuer to audience Signed-off-by: Craig Perkins <cwperx@amazon.com> * Switch to OCT_2 and use String instead of var Signed-off-by: Craig Perkins <cwperx@amazon.com> * Only check required issuer and required audience if set Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix test cases Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove unused import Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Sebastian Michalski <shekerama@gmail.com> Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Sebastian Michalski <shekerama@gmail.com> Signed-off-by: Maciej Mierzwa <dev.maciej.mierzwa@gmail.com>
…ject#2808) * [FEATURE] usage of JWKS with JWT (w/o OpenID connect) Signed-off-by: Sebastian Michalski <shekerama@gmail.com> * Change issuer to audience Signed-off-by: Craig Perkins <cwperx@amazon.com> * Switch to OCT_2 and use String instead of var Signed-off-by: Craig Perkins <cwperx@amazon.com> * Only check required issuer and required audience if set Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix test cases Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove unused import Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Sebastian Michalski <shekerama@gmail.com> Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Sebastian Michalski <shekerama@gmail.com>
…ject#2808) * [FEATURE] usage of JWKS with JWT (w/o OpenID connect) Signed-off-by: Sebastian Michalski <shekerama@gmail.com> * Change issuer to audience Signed-off-by: Craig Perkins <cwperx@amazon.com> * Switch to OCT_2 and use String instead of var Signed-off-by: Craig Perkins <cwperx@amazon.com> * Only check required issuer and required audience if set Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix test cases Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove unused import Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Sebastian Michalski <shekerama@gmail.com> Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Sebastian Michalski <shekerama@gmail.com>
…ject#2808) * [FEATURE] usage of JWKS with JWT (w/o OpenID connect) Signed-off-by: Sebastian Michalski <shekerama@gmail.com> * Change issuer to audience Signed-off-by: Craig Perkins <cwperx@amazon.com> * Switch to OCT_2 and use String instead of var Signed-off-by: Craig Perkins <cwperx@amazon.com> * Only check required issuer and required audience if set Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix test cases Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove unused import Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Sebastian Michalski <shekerama@gmail.com> Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Sebastian Michalski <shekerama@gmail.com> Signed-off-by: Sam <samuel.costa@eliatra.com>
Re-creating #2708 with the jar hell fix merged into main and addressing 2 minor comments from the PR.
Description
Extending auth with jwks_uri parameter to omit passing openid_connect_url with openid-configuration
Issues Resolved
#1858
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.