除非重新启动 WSO2,否则不会考虑对 API 端点范围的更改。产品错误?如果没有,有什么方法可以配置此行为?

Changes to the scope of an API endpoint are not taken into account unless restarting WSO2. Product bug? If not, any way to configure this behaviour?

从 WSO2 中定义的 API 开始,没有与其端点关联的范围...

...我获得访问令牌并正确调用它们。

现在我修改并发布我的 API,在端点上为一个范围分配一个范围,以便它需要编辑器范围:

现在,我使用之前的 access_token 调用该编辑器范围的端点并且它起作用了。 这不应该发生 因为令牌是在默认范围内给出的,而不是编辑器范围。

现在我重新启动 WSO2 并使用相同的令牌再次尝试,得到访问被拒绝的预期结果:

(900910) - The access token does not allow you to access the requested resource</ams:description></ams:fault>% 

我需要重新启动平台以便考虑范围更改!!这是一个错误,一个预期的行为(它不应该......)是否有任何方法可以强制刷新端点要求(除了发布更改的 API)。?

If you generate a new access token after either modifying or deleting a scope of an API resource that you had previously invoked, you will not be able to access that particular resource of the API for a period of 15 minutes, which is the default Gateway cache period, because the WSO2 API Manager Gateway is designed to cache the details of the resource on its side.

参考:https://docs.wso2.com/display/AM250/Scope+Management+with+OAuth+Scopes

这在典型的生产环境中不是实际问题,因为 API 生产环境中的更新非常罕见。

但是,如果这对您来说确实是个问题,您可以覆盖默认范围验证器[1],方法是将其扩展为不使用此缓存。这是在 identity.xml.

中配置的

[1] https://github.com/wso2-extensions/identity-inbound-auth-oauth/blob/master/components/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/validators/JDBCScopeValidator.java#L92