带有Acces令牌的WSO2 IS请求XACML-禁止错误403

问题描述

在本文之后,我创建了请求XACML并获得成功。 https://docs.wso2.com/display/IS560/Using+REST+APIs+via+XACML+to+Manage+Entitlement

在最后一个问题中,我看到可以使用访问令牌进行请求: WSO2is XACML API

我的问题是,是否可以使用访问令牌来接受此请求,因为当我使用基本身份验证时,我在请求中获得了成功,但是当我使用访问令牌时,我得到了403 Forbidden。

如果可以使用访问令牌发出此请求,该怎么办才能解决403问题?

解决方法

是的,您可以使用访问令牌来授权请求​​。如果导航到 /repository/conf/identity/identity.xml文件,则可以找到以下内容。

<Resource context="(.*)/api/identity/entitlement/(.*)" secured="true" http-method="all">
            <Permissions>/permission/admin/manage/identity/pep</Permissions>
            <Scopes>internal_manage_pep</Scopes>
</Resource>

此配置与每个/权利端点的保护方式有关。在https://is.docs.wso2.com/en/latest/develop/authenticating-and-authorizing-rest-apis/#secure-resources

中查找更多详细信息

如果您使用访问令牌,则应使用上述范围生成它。如果访问令牌没有必需的范围,您将收到403 Forbidden。为了向https://localhost:9443/api/identity/entitlement/decision/pdp发出POST请求,您应该使用在internal_manage_pep范围内生成的访问令牌。