WSO2 API管理器 - 验证类型"无"导致APISecurityException

时间:2015-05-07 07:40:13

标签: api wso2 swagger wso2-am

我正在尝试通过WSO2 API Manager通过Swagger UI使用我的API: 我 - >浏览器 - > SwaggerUI-> WSO2-> MyBackend

现在我遇到了问题,Swagger UI总是给我:

{  "error": "no response from server" }

我正在做一些研究并发现,这里的问题与CORS有关。当我尝试GET请求时,Firefox首先发送一个OPTION请求(因为CORS)到WSO2网关。

现在,这里也解释和描述了相同的场景:

https://wso2.org/jira/browse/APIMANAGER-1819

链接中描述的解决方案/解决方法是,在API发布者中,您必须使用方法OPTION为所请求的资源创建端点,并将该OPTION端点的auth类型设置为" none"

然而,这对我没有用,因为我在WSO中获得了一个例外,当传递请求时。

  1. 进入WSO2的HTTP请求:
  2.   

    TID:[0] [AM] [2015-05-07 09:32:50,707] DEBUG {org.apache.synapse.transport.http.wire} - >> " OPTIONS / bankapi / v1 / cashAccounts HTTP / 1.1 [\ r] [\ n]" {} org.apache.synapse.transport.http.wire   TID:[0] [AM] [2015-05-07 09:32:50,707] DEBUG {org.apache.synapse.transport.http.wire} - >> "主持人:10.88.13.104:8243 [\ r] [\ n]" {} org.apache.synapse.transport.http.wire   TID:[0] [AM] [2015-05-07 09:32:50,707] DEBUG {org.apache.synapse.transport.http.wire} - >> " User-Agent:Mozilla / 5.0(Windows NT 6.1; WOW64; rv:37.0)Gecko / 20100101 Firefox / 37.0 [\ r] [\ n]" {} org.apache.synapse.transport.http.wire   TID:[0] [AM] [2015-05-07 09:32:50,707] DEBUG {org.apache.synapse.transport.http.wire} - >> "接受:text / html,application / xhtml + xml,application / xml; q = 0.9, / ; q = 0.8 [\ r] [\ n]" {} org.apache.synapse.transport.http.wire   TID:[0] [AM] [2015-05-07 09:32:50,708] DEBUG {org.apache.synapse.transport.http.wire} - >> "接受语言:en-US,en; q = 0.5 [\ r] [\ n]" {} org.apache.synapse.transport.http.wire   TID:[0] [AM] [2015-05-07 09:32:50,708] DEBUG {org.apache.synapse.transport.http.wire} - >> "接受编码:gzip,deflate [\ r] [\ n]" {} org.apache.synapse.transport.http.wire   TID:[0] [AM] [2015-05-07 09:32:50,708] DEBUG {org.apache.synapse.transport.http.wire} - >> "起源:http://10.88.13.104:8080[ \ r] [\ n]" {} org.apache.synapse.transport.http.wire   TID:[0] [AM] [2015-05-07 09:32:50,708] DEBUG {org.apache.synapse.transport.http.wire} - >> "访问控制请求方法:GET [\ r] [\ n]" {} org.apache.synapse.transport.http.wire   TID:[0] [AM] [2015-05-07 09:32:50,708] DEBUG {org.apache.synapse.transport.http.wire} - >> "连接:保持活着[\ r] [\ n]" {} org.apache.synapse.transport.http.wire   TID:[0] [AM] [2015-05-07 09:32:50,708] DEBUG {org.apache.synapse.transport.http.wire} - >> " [\ R] [\ n]的" {org.apache.synapse.transport.http.wire}

    1. 异常和堆栈跟踪:
    2.   

      TID:[0] [AM] [2015-05-07 09:32:50,878]错误{org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler} - API身份验证失败{org.wso2。 carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler}   org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityException:API的访问失败:/ bankapi,版本:v1,带键:null       在org.wso2.carbon.apimgt.gateway.handlers.security.oauth.OAuthAuthenticator.authenticate(OAuthAuthenticator.java:212)       在org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler.handleRequest(APIAuthenticationHandler.java:94)       在org.apache.synapse.rest.API.process(API.java:284)       在org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:83)       在org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:64)       在org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:220)       在org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:83)       在org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)       at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:344)       在org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:168)       在org.apache.axis2.transport.base.threads.NativeWorkerPool $ 1.run(NativeWorkerPool.java:172)       在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)       at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)       在java.lang.Thread.run(Thread.java:724)

      这里重要的是2 ....即使auth类型为none并且身份验证应该始终成功,在进行身份验证时也会出错。该请求甚至都没有转发到后端(这就是为什么我的问题不重复,但是存在一个非常不同的问题)。

      我在Windows上运行版本1.8.0中的WSO2 API Manager(可以在WSO2站点上下载的二进制包)。 你能帮帮我吗?我错过了什么吗?这是一个普通的错误(它看起来像那样)?

0 个答案:

没有答案