如何在Keycloak资源中添加用于授权的HTTP方法(不带适配器) [英] How to add HTTP methods in Keycloak resources for Authorization (Without adapters)

查看:177
本文介绍了如何在Keycloak资源中添加用于授权的HTTP方法(不带适配器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Keycloak进行授权时,它允许创建受保护的资源.但是它仅允许定义URI.如何为资源添加HTTP方法?

尽管看起来政策执行者允许我们定义此类详细信息,Keycloak如何将HTTP方法与资源进行映射?

预先感谢.

解决方案

如果要将作用域映射到HTTP方法,则需要将http-method-as-scope设置为true.

您可以在这里

使用spring-boot适配器,您可以设置keycloak.policy-enforcer-config.http-method-as-scope=true,并且您的资源将与诸如GET,PUT,POST,DELETE等范围关联.

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.

解决方案

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.

这篇关于如何在Keycloak资源中添加用于授权的HTTP方法(不带适配器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆