-
Notifications
You must be signed in to change notification settings - Fork 343
Modularized PrivilegesEvaluator #5791
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
Modularized PrivilegesEvaluator #5791
Conversation
157cff0 to
ffcb697
Compare
ffcb697 to
7154339
Compare
Signed-off-by: Nils Bandener <[email protected]>
7154339 to
65375fd
Compare
src/main/java/org/opensearch/security/privileges/PrivilegesEvaluatorImpl.java
Show resolved
Hide resolved
shikharj05
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.
src/main/java/org/opensearch/security/privileges/PrivilegesEvaluatorImpl.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/PrivilegesEvaluatorImpl.java
Show resolved
Hide resolved
Signed-off-by: Nils Bandener <[email protected]>
src/main/java/org/opensearch/security/privileges/PrivilegesEvaluator.java
Show resolved
Hide resolved
|
Thank you for this PR @nibix ! The PrivilegesEvaluator class does have too much responsibility and this split up makes perfect sense to me. |
Signed-off-by: Nils Bandener <[email protected]>
|
I forgot to apply one set of changes: As the role mapping has moved to RoleMapper, the class ConfigModel can now be deleted completely. This is done in this commit: |
Signed-off-by: Nils Bandener <[email protected]>
Signed-off-by: Nils Bandener <[email protected]>
Signed-off-by: Nils Bandener <[email protected]>
|
@cwperks @shikharj05 I had to apply a few minor fixes after rebasing to the current main branch. can you please take another look? |
Description
Currently the class
PrivilegesEvaluatorhas many more tasks than evaluating privileges: It also encapsulates configuration for role mapping, multi tenancy, it manages thread context user info data, etc.Goal of this PR is to cut the class
PrivilegesEvaluatorinto several modules with clearly dedicated scopes. Additionally, this PR introduces an interface forPrivilegesEvaluatorwhich has the final goal to make privileges evaluator implementations pluggable (see #5399).The main modules introduced by this PR are:
PrivilegesConfiguration: This now acts as an umbrella over all privileges-related configuration classes. It is centrally instantiated in theOpenSearchSecurityPluginand exists only once per node runtime.PrivilegesEvaluatorwith implementationPrivilegesEvaluatorImplandPrivilegesEvaluator.NotInitialized: This is reduced to the core privilege evaluation.PrivilegesEvaluatorImplnow contains the logic formerly located inPrivilegesEvaluator. Instances ofPrivilegesEvaluatorare managed byPrivilegesConfiguration, which can re-instantiatePrivilegeEvaluatoron demand. Thus,PrivilegesEvaluatorImplhas no longer an unitialized state in case config has not been loaded (yet); the unitialized state is now represented by the classPrivilegesEvaluator.NotInitialized.RoleMapperand classesConfigurableRoleMapperandInjectedRoleMapper. This encapsulates role mapping logic which was formerly sprayed around inPrivilegesEvaluator,SecurityFilterandConfigModel. Instances ofRoleMapperare managed byOpenSearchSecurityPlugin. They are not managed byPrivilegesConfigurationbecause role mapping is not really related to privileges.ThreadContextUserInfo: Encapsulates logic related to writing a user info string into the thread context.DashboardsMultiTenancyConfiguration: A lightweight container for configuration for OpenSearch Dashboards multi tenancy.Testing
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.