Reputation: 23
I want to add one URL configuration which would be dynamic. For eg. URL: /api/v1/{did} and my jwt token would contain user-id, roles where role = did (same as in URL). There are various URL like this with different did but same endpoint and krakend should validate that one user has access to that specific URL(did), so I have roles created in keycloak as did (roles = did). I want to specify roles in krakend json file like roles : [{did}]. Is there any way to achieve this?
Upvotes: 0
Views: 750
Reputation: 1440
That should be possible using a CEL rule (Common Expression Language). With CEL you can set an expression that makes sure that the passed {did}
parameter equals to the content of the JWT attribute containing the role.
The following page has several examples that might help you: https://www.krakend.io/docs/endpoints/common-expression-language-cel/
For the testing I would suggest using the devopsfaith/krakend:watch
command that hots reload the configuration on every change.
Upvotes: 0