Hashicorp vault how to list all roles - hashicorp-vault

Is it possible to list all roles stored in a vault backend? I can't seem to find any reference on how to do so.
From the documentation, it seems possible to list a role given the role name, through auth/approle/role/my-role, for example, but I don't see any references on how to list all roles stored in a vault server.

EDIT
I would recommend viewing roles through the CLI. Viewing roles through the UI seems show all roles instead of those assigned to a given auth method.
Viewing roles using the UI
Click the "Access" tab
Click "View Configuration" under the three dot dropdown for the auth method you're interested in
Click the "Roles" tab at the top
Viewing roles using the CLI
Roles are listed under Authentication Methods in Vault. You can view which authentication methods you have enabled (or enable new ones) by visiting the UI and clicking on the "Access" tab at the top.
From there you can list roles using the following command:
vault list auth/{auth_method}/role
Where {auth_method} is one of the enabled authentication methods listed in the "Access" tab.
For example, if you enabled the kubernetes auth method, you would list roles associated with this method by running the following:
vault list auth/kubernetes/role

It depends on what auth method you created, based on auth method you can list roles.
Example:
# vault list auth/aws/role
# vault read auth/aws/role/role-name

Related

Keycloak 20.0.2: I am not seeing the realm roles in user Role Mapping

When I create a User in my realm, and click the Role Mappings tab, according to every SO post I see there should be a way to select the realm roles to apply. But in my case I am not seeing them.
This is what I see:
I am trying to add the manage_users role, so I can use this User to manage users via the API. But almost all the realm roles are missing from the Role Mapping tab.
Can anyone enlighten me about what else I need to do so the realm roles appear, especially the realm_management ones?
In the Role Mappings tab
You need to click on the Assign role button
which will popup the following menu:
and from there you can find the client and realm roles.
I am trying to add the manage_users role, so I can use this User to
manage users via the API.
If the previous menu you would change Filter by realm roles to Filter by clients, and the following menu would show up:
and in the Search by role name field type realm-management:
select manage_users and then click Assign. You should see that role being assigned to your user

Add predefined list of attributes for role in keycloak

I need to inspect a possibility to create role in a keycloak admin GUI with predefined attributes. Can this attributes been saved and appear in every new role?
I've searched many resources and repos but could not find the answer.
I use keycloak 18.0.2 working on quarkus.
You can add(or update) list of attributes for role
Get the master realm token
see the Create a oauth-token for integration tests
Get the my-realm roles list - copy the name you want to add attributes
Update attribute
Check it attributes added

Give readonly access to dashboard in superset

I have a dashboard in superset, to which I want to give readonly access to some users and that user should also be able to view that dashboard in Dashboard tab.
I have created a Readonly user and have given him datasource access used in that dashboard and Gamma role. After logging into superset with the user I don't see any dashbaord in Dashboard tab, but I am able to open the dashboard using the direct url. And the Edit dashboard button is disabled over there.
If add this user to the owner of the dashboard, I can see the dashboard in the Dashboard tab, but opening it enables Edit button also which I don't want.
Is there a mid way to assign access to the user to see dashboard in list of dahsboard and able to open the same but not able to edit it?
Set the following permissions for the public role and assign the user to that role:
[can dashboard on Superset, can explorev2 on Superset, can explore json on Superset, can csrf token on Superset, can csv on Superset, datasource access on [DATASOURCE][DATABASE], can list on DashboardModelViewAsync, can list on DashboardModelView]
You just need to replace datasource access on [DATASOURCE][DATABASE] with your public datasource and database name

Include groups (along with roles) in Keycloak token?

Is there a way to include the list of groups a user is a member of inside a Keycloak access token, along with the roles they are in? I've created several groups and mapped them to roles. However, I may have more than 1 group that maps to a particular role. I'd like to be able to make fine-grained authorization decisions so I know that User A is in Role A but also Group B. Is that possible?
Found the answer to this right here. All I had to do was add an additional mapper to my Client. Worked like a charm.

how to config Groups-base policies about keycloak

I am keycloak freshman.
I want to create a fairly simple groups-based access control system using Keycloak's authorizaion system.
I try to config a groups-based policy but failure,my step as following:
1.Creating a group name of "user",
2.Configing resource,scope and so on
3.Setting policies as Group-base policy,but in this step ,this is something confused about me "Groups Claim",the description of "Groups Claim" is :
"A claim to use as the source for users group. If the claim is present it must be an array of strings".
follow this description i configed the "[user]" in this field.
Is there something wrong with me configuration?
Could someone can give me some guidance?
Thanks.
Usually with keycloak you are doing authorization by using roles. Groups then can be utilized to associate roles to multiple users (the users of the groups).
If you need more fine-grained authorization capabilities than roles, you can have a look at keycloak's authorization sub-system with resources, permissions, policies and authorization scopes.
But for simplicity I recommend starting with roles.