Keycloak 如何将http方法添加到Key斗篷的资源中
我想要keydepot保护我的Restful URL,例如:Keycloak 如何将http方法添加到Key斗篷的资源中,keycloak,restful-url,Keycloak,Restful Url,我想要keydepot保护我的Restful URL,例如:POST/user/1,DELETE/user/1。 当我在KeyClope中创建新资源时,我发现只有URI,但不存在HTTP方法。 那么我如何区分删除和发布呢 有资源的概念,您也可以在请求方法级别定义授权,例如: resources: - uri: /* - uri: /users/* methods: - GET roles: - viewer - uri: /users/* methods: - POST
POST/user/1
,DELETE/user/1
。
当我在KeyClope中创建新资源时,我发现只有URI,但不存在HTTP方法。
那么我如何区分删除和发布呢 有资源的概念,您也可以在请求方法级别定义授权,例如:
resources:
- uri: /*
- uri: /users/*
methods:
- GET
roles:
- viewer
- uri: /users/*
methods:
- POST
- DELETE
roles:
- editor
有一种可能的解决方案使用授权作用域。您可以创建GET、POST、删除授权范围,并将其与资源关联,然后创建范围基权限。例如,与Spring Boot集成时,您只需在application.properties中提供此设置:
keycloak.policy-enforcer-config.http-method-as-scope=true