wso2is - 无法通过 Angular 访问 WSO2 IS 5.3.0 管理服务
问题描述
我们无法从 Angular 代码中调用ChallengeQuestionManagementAdminService 。收到错误说明无效的远程地址
在授权中包含用户凭据。能够使用 SOAP UI 但不能从 Angular 使用服务。
管理服务:ChallengeQuestionManagementAdminService
错误:
[2019-03-26 03:33:54,314] WARN {org.wso2.carbon.core.services.authentication.AuthenticationUtil} - Could not find IP address for domain name : 10.44.1.25:51954
[2019-03-26 03:33:54,315] ERROR {org.wso2.carbon.core.services.authentication.AbstractAuthenticator} - Invalid remote address detected.
org.wso2.carbon.core.common.AuthenticationException: Authentication Failed : Invalid remote address passed - 10.44.1.25:51954
at org.wso2.carbon.core.services.authentication.AuthenticationUtil.validateRemoteAddress(AuthenticationUtil.java:178)
at org.wso2.carbon.core.services.authentication.AuthenticationUtil.getRemoteAddress(AuthenticationUtil.java:156)
at org.wso2.carbon.core.services.authentication.AbstractAuthenticator.getRemoteAddress(AbstractAuthenticator.java:304)
at org.wso2.carbon.core.services.authentication.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:136)
at org.wso2.carbon.server.admin.module.handler.AuthenticationHandler.isAuthenticated(AuthenticationHandler.java:180)
at org.wso2.carbon.server.admin.module.handler.AuthenticationHandler.authenticate(AuthenticationHandler.java:105)
at org.wso2.carbon.server.admin.module.handler.AuthenticationHandler.invoke(AuthenticationHandler.java:66)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
解决方案
通过邮递员发布您从 Angular 发送的请求,并检查其是否成功。如果是,请确保您从 Angular 发送所有必需的标头,否则您可能会丢失一些标头,或者您的请求模式可能会丢失一些参数。
要包含的标题
headers.set( 'Accept', '*/*');
headers.set( 'Content-Type', 'text/xml;charset=UTF-8');
headers.set( 'Authorization', `Basic ${authToken}`); <!--should send base64encode(username:password) specific to account. -->
headers.set( 'SOAPAction', 'urn:setUserChallengeAnswers');
推荐阅读
- c++ - 这个星号 (*) 在 C++ 中的含义是什么?-- 指向成员的指针
- python - python:如何确定一个值是否包含在二维列表的某一列中?
- javascript - 更改 img 并保存 cookie html & javascript
- ubuntu - 如何使用 Ubuntu 在 electron.dialog.showOpenDialog 中查看自定义书签?
- meteor - Meteor + Apollo 订阅:Websocket 连接关闭
- android - 如何在两个布局上放置叠加图像视图?
- ansible - 是否可以在清单文件中使用“主机名”作为 uri 模块中的参数“url”?
- python - django-rest-framework 中的 PDF
- python - Python - 迭代两个 CSV 文件中的每一行并比较时间戳值
- r - 创建 Rcpp 矩阵列表