WSO2:API无法在独立网关中进行身份验证

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

我们遇到了与运行 WSO2 AM 2.1.0 的网关节点上的 WSO2 身份验证失败中报告的类似问题,但我们的配置略有不同,并且我们做了一些额外的测试

环境: Ubuntu LTS 16.04.4 Java“1.8.0_171”(已知报告的问题,见下文) WSO2 2.1.0 我们已停用 3 个节点中的压缩,编辑 catalina-server.xml 补充:我们在将Java降级到1.8.0_144后重复了测试。结果相同。

我们在同一台机器上部署了3个节点 - 1个管理器wso2server.sh启动 - 2个网关 wso2server.sh -Dprofile=gateway-manager 启动 - 独特的H2数据库集,为所有节点共享 (我们可以随时从头开始重建环境)

初步测试

  • 我们已经使用 thrift 配置了 API 密钥验证器。只有一台ThriftServer,在管理节点启动
  • 管理器节点密钥 API 密钥验证器(通过 example.com 更改真实主机名)

        <APIKeyValidator>
        <ServerURL>https://apimanager.example.com:9443/services/</ServerURL>
        <Username>${admin.username}</Username>
        <Password>${admin.password}</Password>
        <KeyValidatorClientType>ThriftClient</KeyValidatorClientType>
        <ThriftClientConnectionTimeOut>10000</ThriftClientConnectionTimeOut>
        <EnableThriftServer>true</EnableThriftServer>
        <ThriftServerHost>apimanager.example.com</ThriftServerHost>
        <ThriftClientPort>10397</ThriftClientPort>
        <KeyValidationHandlerClassName>org.wso2.carbon.apimgt.keymgt.handlers.DefaultKeyValidationHandler</KeyValidationHandlerClassName>
        </APIKeyValidator>
    
  • 沙箱和网关节点密钥 API Key Validator 的配置相同,只是参数

    <EnableThriftServer>
    false

测试结果 在 API 控制台中,我们得到(我们在 GET /menu 中使用 PizzaShack API 示例)

{ "fault": { "code": 900900, "message": "Unclassified Authentication Failure", "description": "Error while accessing backend services for API key validation" } }

网关追踪

TID: [-1234] [] [2018-05-21 13:15:17,351]  WARN {org.wso2.carbon.apimgt.gateway.handlers.security.thrift.ThriftKeyValidatorClient} -  Login failed.. Authenticating again.. {org.wso2.carbon.apimgt.gateway.handlers.security.thrift.ThriftKeyValidatorClient}
TID: [-1234] [] [2018-05-21 13:15:17,392]  WARN {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler} -  API authentication failure due to Unclassified Authentication Failure {org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler}

管理器跟踪(API 控制台)

TID: [-1234] [] [2018-05-21 13:15:17,372]  INFO {org.wso2.carbon.core.services.util.CarbonAuthenticationUtil} -  '[email protected] [-1234]' logged in at [2018-05-21 13:15:17,372+0200] from IP address  {org.wso2.carbon.core.services.util.CarbonAuthenticationUtil}

启用调试功能进行测试

由于之前的错误,无法进行调试测试(请参阅下面Bee的评论)

额外测试

  • 按照原始帖子的建议,我们已将 APIKeyValidator 更改为 WSClient。经过一些初始配置问题后,这个工作正常
  • 我们也尝试过使用 CURL 进行调用,没有变化。
wso2 wso2-api-manager gateway
1个回答
0
投票

此问题与端点 jwks url 有关。您应该转到管理页面 > Key_namager 然后找到 jwks url 端点并更改它。这对我的案子确实有帮助!

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