-
Notifications
You must be signed in to change notification settings - Fork 336
Selective User Cache Invalidation Enhancement #5337
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
Selective User Cache Invalidation Enhancement #5337
Conversation
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
… backendRegistry Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5337 +/- ##
==========================================
+ Coverage 72.06% 72.08% +0.01%
==========================================
Files 381 381
Lines 23608 23654 +46
Branches 3621 3632 +11
==========================================
+ Hits 17014 17050 +36
- Misses 4798 4799 +1
- Partials 1796 1805 +9
🚀 New features to boost your workflow:
|
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
src/main/java/org/opensearch/security/action/configupdate/TransportConfigUpdateAction.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/action/configupdate/TransportConfigUpdateAction.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/auth/BackendRegistry.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/dlic/rest/api/FlushCacheApiAction.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Rishav Kumar <[email protected]>
src/main/java/org/opensearch/security/action/configupdate/ConfigUpdateRequest.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/dlic/rest/api/FlushCacheApiAction.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/action/configupdate/ConfigUpdateRequest.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/security/action/configupdate/TransportConfigUpdateAction.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
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.
Thank you @Rishav9852Kumar. This change looks good to me! From an end-user perspective, the /_plugins/_security/cache/user/{username}
makes sense to me.
I know there is still some discussion on the organization around the internal transport action, but since that's not user facing I think that can be addressed in a separate PR and I see that there's already a comment in the code explaining the re-use of the action.
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
Signed-off-by: Rishav Kumar <[email protected]>
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.
Thanks @Rishav9852Kumar - as a follow-up, can you try and improve coverage for the changes? For e.g. see https://github.com/opensearch-project/security/pull/5337/checks?check_run_id=42888662886 for missing coverage
Description
Currently, our system only allows for the invalidation of the entire user authentication cache, which can lead to numerous cache misses and inefficiencies. When dealing with LDAP user updates, this global cache invalidation affects all users unnecessarily.
Solution
This PR introduces a new REST endpoint that enables selective cache invalidation at the individual user level. This allows for more precise cache management, particularly useful when handling LDAP user updates where only specific user entries become stale.
Key Changes
/api/security/authcache/users/{username}
for selective cache invalidationBenefits
Developer Note
This issue was aimed as an excellent introduction to the plugin development workflow, touching all crucial aspects including REST API development, integration testing, unit testing, and authentication handling with external providers - making it an ideal "good first issue" for new contributors.
Acknowledgments
This work builds upon the contributions of:
Related Work
Issues Resolved
#2829
Is this a backport? If so, please add backport PR # and/or commits #, and remove
backport-failed
label from the original PR.Do these changes introduce new permission(s) to be displayed in the static dropdown on the front-end? If so, please open a draft PR in the security dashboards plugin and link the draft PR here
Testing
IntegrationTest
LdapAuthenticationCacheTest.java
FlushCacheApiIntegrationTest.java
Unit tesing
FlushCacheApiTest.java
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.