-
Notifications
You must be signed in to change notification settings - Fork 281
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
[BUG] Question about and_backend_roles support for creating a role mapping #4084
Comments
Hi @rblcoder , thank you for creating an issue. The
For the example you provided:
In order for a user to be mapped successfully to |
@cwperks Thank you for your reply. The purpose behind and_backend_roles is still not clear to me. Please share link for documentation and also examples. In my example admin, hr1, it1 are users. I am able to map them to the role all_access using backend_roles. Needed to understand about and_backend_roles. |
@rblcoder If you want to directly map users to roles than you would use user mapping like this:
Backend roles are typically used when you have OpenSearch Dashboards configured with a Single Sign-On provider and the user (and their attributes like roles) are external to OpenSearch and instead defined in a central Identity Provider (IdP). When authenticated, OpenSearch will get the user's roles from that external IdP and those are referred to as backend roles - opposed to roles defined in OpenSearch. To map backend roles to roles defined in OpenSearch, you can either use direct Effectively, I will create an issue on the documentation-website to go over role mapping in more detail. Currently role mapping supports 4 different methods:
|
Thank you @cwperks for your reply. Could you please also point to the code implementation and unit tests for |
The implementation for |
@cwperks ConfigModelV7 extends ConfigModel. Could you please share the code flow for creating the roles mapping when the create roles mapping rest api is called and also evaluating the same for checking permissions? |
RolesMappingApi Handler: https://github.com/opensearch-project/security/blob/main/src/main/java/org/opensearch/security/dlic/rest/api/RolesMappingApiAction.java The actual mapping of the roles occurs here. The mapped roles are used to evaluate whether a user is permitted to perform the given transport action or not. |
In the following, all the users from roleMapValue.getUsers() are added to users
In the following, all the backend roles from roleMapValue.getBackend_roles() are added to bars
In the following all the and_backend_roles from roleMapValue.getAnd_backend_roles() are added to abars
I am trying to understand what is happening here security/src/main/java/org/opensearch/security/securityconf/ConfigModelV7.java Lines 1316 to 1327 in f375765
Whatever is matching between userMatchers and user.getName(), the corresponding role to which the user is been mapped is added to securityRoles Similarly with barMatchers and user.getRoles() For abars and user.getRoles(), every backend_role in abars needs to be present in user.getRoles() for the mapping to work. |
Have created an issue to support the same in dashboards. |
@cwperks Thank you. |
What is the bug?
While creating a role mapping and specifying and_backend_roles, the data specified as and_backend_roles does not seem to have any effect.
How can one reproduce the bug?
Steps to reproduce the behavior:
When I try to create a role mapping using the API
The UI only shows admin and hr1 mapped to all_access
Also if I execute the API as follows
the admin user loses access.
What is the expected behavior?
The entities specified in and_backend_roles also need to be mapped to the role.
If this is not supposed to be so, please remove all reference to this
https://github.com/search?q=org%3Aopensearch-project+and_backend_roles&type=code
What is your host/environment?
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
Do you have any screenshots?
[
]
Do you have any additional context?
Add any other context about the problem.
The text was updated successfully, but these errors were encountered: