Nirojan Selvanathan
Nirojan Selvanathan

Reputation: 11164

How to add HTTP methods in Keycloak resources for Authorization (Without adapters)

When using Keycloak for authorization it allows creating protected resources. But it only allows defining the URI. How can I also add the HTTP method for the resource?

Although it seems the policy enforcers allows us to define such details, how is Keycloak able to map the HTTP method with the resource?

Thanks in Advance.

enter image description here

Upvotes: 4

Views: 3446

Answers (1)

ravthiru
ravthiru

Reputation: 9633

If you want scopes to be mapped to HTTP methods then you need to set http-method-as-scope to true.

You can check policy enforcer documentation here

With spring-boot adapter you can set keycloak.policy-enforcer-config.http-method-as-scope=true and your resources would be associated with scopes such as GET, PUT, POST, DELETE, etc.

Upvotes: 3

Related Questions