首页 > 解决方案 > 无法通过 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)

标签: wso2is

解决方案


通过邮递员发布您从 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');

推荐阅读