7

I am using kong as my api-gateway and using a plugin kong-oidc for authentication using keycloak. Authentication process is smooth and running fine. Now I want to add authorization for the requests made to kong for different microservices. I am planning to modify the kong-oidc plugin. I have created a confidential client, role-based policies and resource based permissions along with some users assigned with different roles in keycloak. I want to authorize a user if he has a permission to access a specific resource. I can do that by following request

http://keycloak-url/auth/realms/$realm/protocol/openid-connect/token \
  -H "Authorization: Bearer "$access_token \
  --data "grant_type=urn:ietf:params:oauth:grant-type:uma-ticket" \
  --data "audience=auth-client" \              
  --data "permission=af-resource" \     
  --data "response_mode=decision"

I am concerned with permission=af-resource. during the request I can not know the name of the resource but the requested url. Do I have to request to keycloak again to give me the resource-id for the requested-url and then send the above mentioned request for decision or there is another way? Or somehow i can use the information from token-introspection endpoint.

Ahmed Nawaz Khan
  • 1,451
  • 3
  • 20
  • 42
  • @https://stackoverflow.com/users/476828/subodh-joshi any thoughts? – Ahmed Nawaz Khan Jan 09 '20 at 17:21
  • 2
    have you managed to get a Kong plugin to work with Keycloak's authorization services? I'm interested in doing exactly the same thing you've described in your question. – Kassem Feb 02 '21 at 12:29

0 Answers0