【问题标题】:Direct naked impersonation直接裸装
【发布时间】:2021-04-24 08:01:43
【问题描述】:

我在使这些步骤正常工作时遇到问题,记录在 Securing Applications and Services Guide 中。 stackoverflow 中的This thread 显示了一个效果不佳的选项。有人可以指出解决此问题以允许赤身裸体所需的步骤吗?

所附图片中的领域/客户端/策略/用户详细信息。 enter image description here

查询:

curl -k -X POST
–header ‘Content-Type: application/x-www-form-urlencoded’
–data-urlencode “client_id=starting-client”
–data-urlencode “client_secret=.....”
–data-urlencode “grant_type=urn:ietf:params:oauth:grant-type:token-exchange”
–data-urlencode “requested_subject=target-user”
https://localhost:8543/auth/realms/target_realm/protocol/openid-connect/token

回复:

{“error”:“access_denied”,“error_description”:“Client not allowed to exchange”}

服务器日志:

22:40:08,396 WARN [org.keycloak.events] (default task-149) type=TOKEN_EXCHANGE_ERROR, realmId=target_realm, clientId=starting-client, userId=null, ipAddress=172.17.0.1, error=not_allowed, reason=‘client not allowed to impersonate’, auth_method=token_exchange, grant_type=urn:ietf:params:oauth:grant-type:token-exchange, requested_subject=target-user, client_auth_method=client-secret

【问题讨论】:

    标签: authentication keycloak impersonation


    【解决方案1】:

    这是Securing Applications and Services Guide 中的文档的问题。必须为范围“模拟”添加策略,而不是为范围“用户模拟”添加客户端策略。更改完成后,它就开始工作了。

    【讨论】:

    • 这对你有用吗?即使使用impersonate 范围,它仍然对我不起作用
    • 我还尝试解决将“用户模拟”更改为“模拟”的问题,但这并没有成功。你设法解决了这个问题?
    【解决方案2】:

    请使用以下请求格式,它应该可以工作。经过测试和验证。

    curl --location --request POST 'https://api.kong.stg.vrpintegration.dev/requestJWT/token' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data-urlencode 'grant_type=urn:ietf:params:oauth:grant-type:token-exchange' \
    --data-urlencode 'client_id=CLIENT_ID' \
    --data-urlencode 'client_secret=bddf3a83-f4ec-45f6-afa0-cf9c94cb5518' \
    --data-urlencode 'subject_token=xxxxxx' \
    --data-urlencode 'audience=CLIENT_ID' \
    --data-urlencode 'requested_token_type=urn:ietf:params:oauth:token-type:refresh_token'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多