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

Viewed 1422

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

1 Answers

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.

Related