Enable Role-Based Authorization
Last updated
Last updated
Open OpenShift web console, switch to Administrator perspective, and make sure you've selected service-registry
project (or the project you've install Service Registry). Select Workloads -> Deployments menu, then click on service-registry-deployment
link.
Go to Environment tab, click Add more to add a new environment variable. Enter ROLE_BASED_AUTHZ_ENABLED
as a name and true
as its value, then click Save button.
Open SSO web console, select Registry realm (or the realm you used for Service Registry). Select Clients menu then click on the client you need to configure.
Make sure the Access Type is confidential
and Service Accounts Enabled option is ON
Go to Service Account Roles tab and assign one of valid roles (sr-admin
, sr-developer
, sr-readonly
) for the client.
Use Postman to get a token from Red Hat SSO. Then try to call the API that's not allowed for the current role assigned to client, in this case, client with sr-readonly
role is not allowed to create artefact. The API call should be failed as a screenshot below for example.
For Kafka Java client application, Authorization error should be thrown when the client application is trying to perform any operation that's not allowed for it's role.
You can optionally go to jwt.io website and decode the token returned from SSO. You'll see the roles
contains only the role you assgined for the client.