-
Notifications
You must be signed in to change notification settings - Fork 274
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
Generalize public key reading in the JWT authenticator #4833
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
@@ -52,8 +52,8 @@ public JwtParserBuilder run() { | |||
} else { | |||
try { | |||
PublicKey key = null; | |||
|
|||
final String minimalKeyFormat = signingKey.replace("-----BEGIN PUBLIC KEY-----\n", "") | |||
final String minimalKeyFormat = signingKey.replaceAll("\\r|\\n", "") |
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.
Do we want to use something like: https://docs.oracle.com/javase/9/docs/api/java/lang/System.html#lineSeparator-- instead? I think this is also fine though.
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.
Although this will also include test modifications so maybe more hassle than it is worth - the test change would maybe just be System.lineSeparator() + key, then the test passing on both linux and windows should be enough to test the validity of this fix.
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.
Minor comment
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4833 +/- ##
==========================================
- Coverage 70.99% 70.94% -0.05%
==========================================
Files 310 310
Lines 20938 20951 +13
Branches 3326 3331 +5
==========================================
- Hits 14865 14864 -1
- Misses 4325 4336 +11
- Partials 1748 1751 +3
|
Description
This PR generalizes public key reading in the JWT authenticator to support configuring the JWT authenticator with inline public cert like this:
Currently, the JWT authenticator will fail to initialize because it is not removing the line endings when parsing this value. The resulting error was:
Enhancement
Issues Resolved
Resolves: #4406
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.