Keycloak-Connect Node.js policy enforcer dynamic resources

92 views
Skip to first unread message

Kevin Hertwig

unread,
Apr 7, 2021, 11:33:44 AM4/7/21
to Keycloak User

Hello together,

I have registered multiple resources on the Authorization Server, which are named as Process_{id}, where {id} is a random uuid.

When using the policy enforcer middleware in the Keycloak-Connect Node.js library, I would protect my route as follows:

app.get(’/processes/:id’, keycloak.enforcer(’{name of resource}:view’), handler) where {name of resource} is the name of the resource that is registered at the Authorization Server, for example Process_5e2d1aca-6c39-4719-b2a5-5f55dada9ea0.

So far, I have only seen examples, where {name of resource} is hardcoded. How would you implement this with a dynamic resource name based on the query string, that identifies the process that is requested?

Osama Salem

unread,
Sep 7, 2021, 5:15:55 AM9/7/21
to Keycloak User
Were you able to come up with a solution for this? I have the same issue.
Reply all
Reply to author
Forward
0 new messages