-
Couldn't load subscription status.
- Fork 337
Handle roles in nested claim for JWT auth backends #5355
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
Handle roles in nested claim for JWT auth backends #5355
Conversation
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5355 +/- ##
==========================================
- Coverage 72.15% 72.14% -0.01%
==========================================
Files 382 382
Lines 23674 23697 +23
Branches 3640 3644 +4
==========================================
+ Hits 17081 17097 +16
- Misses 4798 4802 +4
- Partials 1795 1798 +3
🚀 New features to boost your workflow:
|
Signed-off-by: Craig Perkins <cwperx@amazon.com>
|
Thanks @cwperks for the contribution — I’ve merged your changes into my local cluster and conducted some testing. Here’s how I configured the roles_key:
- test.attributes
- test.rolesAnd for all_access:
reserved: false
backend_roles:
- "admin"
- "Administrator"For reference, this is the structure of my JWT: test.attributes: {
"test.roles": ["Administrator"]
}I verified the assigned permissions using This change works seamlessly 👍 |
|
Thank you for confirming @Yusuf-Uzun ! |
src/main/java/org/opensearch/security/auth/http/jwt/HTTPJwtAuthenticator.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/auth/http/jwt/HTTPJwtAuthenticator.java
Outdated
Show resolved
Hide resolved
src/integrationTest/java/org/opensearch/security/http/JwtAuthorizationHeaderFactory.java
Show resolved
Hide resolved
src/integrationTest/java/org/opensearch/security/http/JwtAuthorizationHeaderFactory.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/auth/http/jwt/HTTPJwtAuthenticator.java
Show resolved
Hide resolved
Signed-off-by: Craig Perkins <cwperx@amazon.com>
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.
LGTM
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
|
Resolve conflict in CHANGELOG |
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.
Nice work @cwperks ! thanks :)
|
We should take the same approach from this PR to abstract |
Description
This PR abstracts the
roles_keyconfiguration from jwt-backed auth backends to handle a list as config to get roles within nested claims of a JWT payload.Enhancement
Issues Resolved
Resolves #5343
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.