Security WSO2 ESB AuthenticationMediator无法向Identity Server发送消息
我在将WSO2 identity server与ESB集成时遇到了一个问题 在遵循指南之后,我发现ESB收到了来自客户机的消息,但我没有发现ESB向Identity Server发送了消息 我尝试了Security WSO2 ESB AuthenticationMediator无法向Identity Server发送消息,security,wso2,esb,identity,Security,Wso2,Esb,Identity,我在将WSO2 identity server与ESB集成时遇到了一个问题 在遵循指南之后,我发现ESB收到了来自客户机的消息,但我没有发现ESB向Identity Server发送了消息 我尝试了wso2esb-4.7.0和wso2is-4.1.0 以下是我采取的步骤: 将WSO2 Identity Server配置为XACML引擎,启动Identity Server 在WSO2 ESB中配置授权中介并启动ESB 在IDE中运行客户端代码 在ESB和IS中,没有输出消息 在客户端IDE中,控制
wso2esb-4.7.0
和wso2is-4.1.0
以下是我采取的步骤:
......
13/08/05 15:24:15 INFO deployment.ModuleDeployer: Deploying module: rahas - file:/D:/project/wso2/test/wso2esb-4.7.0/repository/components/plugins/rampart-trust_1.6.1.wso2v8.jar
13/08/05 15:24:15 ERROR sandesha2.SandeshaModule: Could not load module policies. Using default values.
13/08/05 15:24:15 INFO tcp.TCPTransportSender: TCP Sender started
13/08/05 15:24:17 ERROR engine.AxisEngine: Missing wsse:Security header in request
org.apache.axis2.AxisFault: Missing wsse:Security header in request
at org.apache.rampart.handler.RampartReceiver.setFaultCodeAndThrowAxisFault(RampartReceiver.java:180)
at org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:99)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:356)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:413)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:224)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:554)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:530)
at org.wso2.entitlement.sample.WSEntitlementTestClient.main(WSEntitlementTestClient.java:59)
Caused by: org.apache.rampart.RampartException: Missing wsse:Security header in request
at org.apache.rampart.RampartEngine.process(RampartEngine.java:141)
at org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:92)
... 11 more
Exception in thread "main" org.apache.axis2.AxisFault: Missing wsse:Security header in request
at org.apache.rampart.handler.RampartReceiver.setFaultCodeAndThrowAxisFault(RampartReceiver.java:180)
at org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:99)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:356)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:413)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:224)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:554)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:530)
at org.wso2.entitlement.sample.WSEntitlementTestClient.main(WSEntitlementTestClient.java:59)
Caused by: org.apache.rampart.RampartException: Missing wsse:Security header in request
at org.apache.rampart.RampartEngine.process(RampartEngine.java:141)
at org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:92)
... 11 more
以下是客户端源代码:
package org.wso2.entity.sample;
导入org.apache.axiom.om.OMAbstractFactory;
导入org.apache.axiom.om.OMElement;
导入org.apache.axiom.om.OMFactory;
导入org.apache.axiom.om.OMNamespace;
导入org.apache.axiom.om.impl.builder.statxombuilder;
导入org.apache.axis2.Constants;
导入org.apache.axis2.addressing.EndpointReference;
导入org.apache.axis2.client.Options;
导入org.apache.axis2.client.ServiceClient;
导入org.apache.axis2.context.ConfigurationContext;
导入org.apache.axis2.context.ConfigurationContextFactory;
导入org.apache.neethi.Policy;
导入org.apache.neethi.PolicyEngine;
导入org.apache.rampart.RampartMessageData;
公共类WSAuthenticationTestClient{
最终静态字符串ADDR\u URL=”http://localhost:8280/services/echo"; //"http://localhost:8280/services/MarketDataService";
最终静态字符串TRANS_URL=”https://localhost:8243/services/EntitlementService"; // "https://localhost:8243/services/EntitlementProxy";
公共静态void main(字符串[]args)引发异常{
ServiceClient=null;
选项=null;
OmeElement响应=null;
ConfigurationContext=null;
字符串trustStore=null;
//您需要将ESBs公共证书导入此密钥存储。
trustStore=“wso2carbon.jks”;
//我们正在通过HTTPS访问ESB,因此需要设置信任库参数。
setProperty(“javax.net.ssl.trustStore”,trustStore);
//mykeystore.jks的密码
setProperty(“javax.net.ssl.trustStorePassword”、“wso2carbon”);
//创建配置上下文-您将在client.axis2.xml中使用Rampart模块
context=ConfigurationContextFactory.createConfigurationContextFromFileSystem(“repo”、“repo/conf/axis2_client.xml”);
//这是应用于UT的代理服务的安全策略。
StAXOMBuilder builder=new StAXOMBuilder(“policy.xml”);
Policy Policy=PolicyEngine.getPolicy(builder.getDocumentElement());
//context=ConfigurationContextFactory.createConfigurationContextFromFileSystem(“repo”、“repo/conf/client.axis2.xml”);
client=newserviceclient(上下文,null);
选项=新选项();
options.setAction(“urn:echoString”);
//这是指向部署在ESB中的echo服务的寻址URL
setTo(新端点引用(ADDR_URL));
//对于ESB,代理服务
选项。设置用户名(“管理员”);
选项。设置密码(“管理员”);
//TRANS_URL指向代理服务
options.setProperty(Constants.Configuration.TRANSPORT\u URL、TRANS\u URL);
options.setProperty(RampartMessageData.KEY\u RAMPART\u POLICY,POLICY);
client.setOptions(选项);
客户业务模块(“寻址”);
客户业务模块(“rampart”);
response=client.sendReceive(getPayload(“Hello world”);
System.out.println(响应);
}
私有静态OMElement getPayload(字符串值){
OMFactory=null;
omns=null;
OMElement elem=null;
OmeElement childElem=null;
factory=OMAbstractFactory.getOMFactory();
ns=工厂。createOMNamespace(“http://echo.services.core.carbon.wso2.org“,“ns1”);
elem=factory.createOmeElement(“echoString”,ns);
childElem=factory.createOmeElement(“in”,null);
childElem.setText(值);
元素addChild(childElem);
返回元素;
}
}
以下是Identity Server中的授权策略:
注释说明
http://localhost:8280/services/echo
阅读
管理
以下是ESB中的AuthenticationService源:
在ESB SOAP消息跟踪器中,我可以看到以下请求消息:
2013-08-05T06:10:20.503Z
2013-08-05T06:15:20.503Z
aaa
管理
http://localhost:8280/services/echo
urn:uuid:269da889-ce33-4138-b050-3F4913DBC17
urn:echoString
你好,世界
连同以下回应:
urn:echoStringResponse
urn:uuid:269da889-ce33-4138-b050-3F4913DBC17
你好,世界
但是在Identity Server SOAP消息跟踪器中,请求消息和响应消息都是空的。ESB似乎不向Identity Server发送任何消息
有人知道怎么回事吗?首先,WSO2 ESB 4.7.0和WSO2 is 4.1.0是不兼容的版本。您可以将ESB4.6.0与IS 4.1.0一起使用,也可以将WSO2 IS 4.5.0(即将发布)与当前ESB一起使用 您面临的此错误“请求中缺少wsse:Security header”可能是因为BasicAuth场景,即它首先发送一个没有用户名和密码的请求,让服务器提交质询。只有在收到质询后,客户端才会发送basicAuth参数 干杯
普什帕兰卡您能解释一下为什么或以什么方式不兼容吗?它是