在Keyrock中出现403错误 "User not allow to perform action",无法解释。

问题描述 投票:0回答:1

我一直在纠结这个问题,不知道有没有人有同样的问题。

我有一个 Keyrock 7.8.0 + MySQL架构,按照FIWARE教程的建议,使用docker运行。我可以通过localhost:3005访问GUI和API。通过管理员用户的GUI,一切似乎都很好,但当涉及到授予。与管理员身份证明角色给用户

curl -X PUT \
  http://localhost:3005/v1/applications/20f9bc1d-a9d1-45af-bdd9-f96fdc7a1ec9/users/c8336e47-8e3b-4081-b0f7-b2a3431847d7/roles/55e8a41c-52b5-4ef9-ad9c-ef60762d32e3 \
  -H 'Accept: */*' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: 0' \
  -H 'Content-Type: application/json' \
  -H 'Cookie: session=eyJyZWRpciI6Ii8ifQ==; session.sig=TqcHvLKCvDVxuMk5xVfrKEP-GSQ' \
  -H 'Host: localhost:3005' \
  -H 'Postman-Token: cb7e8ae3-87b4-4d8e-9fb7-a66ef439a7cf,7f736505-8c7e-4991-8449-ebd6e54714f7' \
  -H 'User-Agent: PostmanRuntime/7.19.0' \
  -H 'X-Auth-token: f20c72c6-7c2a-4d8e-8d48-568e1c4e47d6' \
  -H 'cache-control: no-cache'

或一个组织。

curl -X PUT \
  http://localhost:3005/v1/applications/20f9bc1d-a9d1-45af-bdd9-f96fdc7a1ec9/organizations/d98534f7-ecaa-4c38-93cc-c17d87f010ee/roles/55e8a41c-52b5-4ef9-ad9c-ef60762d32e3/organization_roles/member \
  -H 'Accept: */*' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: 0' \
  -H 'Content-Type: application/json' \
  -H 'Cookie: session=eyJyZWRpciI6Ii8ifQ==; session.sig=TqcHvLKCvDVxuMk5xVfrKEP-GSQ' \
  -H 'Host: localhost:3005' \
  -H 'Postman-Token: 11fc3dbb-8484-482f-8bc1-af89dcdeebb5,8bfdcdb5-f200-4bee-bcee-a8f6d83b18f0' \
  -H 'User-Agent: PostmanRuntime/7.19.0' \
  -H 'X-Auth-token: f20c72c6-7c2a-4d8e-8d48-568e1c4e47d6' \
  -H 'cache-control: no-cache'

它只是在正文中回复了这个错误。

{
    "error": {
        "message": "User not allow to perform the action",
        "code": 403,
        "title": "Forbidden"
    }
}

有谁知道,同一个用户怎么会有权限 通过GUI做一件事,而不是通过API?

http-status-code-403 fiware fiware-keyrock
1个回答
0
投票

我们也遇到了同样的问题,大概找到了解决办法。

根据文档中给组织分配角色或给用户分配角色时,必须使用HTTP动词PUT。在现实中,Keyrock就会以如下的错误信息进行响应。

{ 
   "error": {
      "message": "User not allow to perform the action",
      "code": 403,
      "title": "Forbidden"   
   }
}

当我们使用HTTP动词POST而不是PUT时,角色已成功分配给组织用户。

因此,我们认为是文档或实现有问题。

源头:http:/github https:/github.comgingfiware-idmissues144

© www.soinside.com 2019 - 2024. All rights reserved.