When applying security scenario 1 to a Proxy in wso2 esb , I get the following errors , but only when the Respond mediator is reached.
> TID: [0] [ESB] [2015-03-23 12:52:05,418] DEBUG
> {org.apache.synapse.mediators.builtin.SendMediator} - Start : Send
> mediator {org.apache.synapse.mediators.builtin.SendMediator} TID: [0]
> [ESB] [2015-03-23 12:52:05,419] DEBUG
> {org.apache.synapse.mediators.builtin.SendMediator} - Sending
> response message using implicit message properties.. Sending To:
> http://www.w3.org/2005/08/addressing/anonymous SOAPAction:
> {org.apache.synapse.mediators.builtin.SendMediator} TID: [0] [ESB]
> [2015-03-23 12:52:05,511] ERROR
> {org.apache.synapse.core.axis2.Axis2Sender} -
> Content-Type:text/xml;charset=UTF-8,Date:Mon, 23 Mar 2015 10:52:02
> GMT,Server:WSO2 Carbon Server,Transfer-Encoding:chunked,<?xml
> version="1.0" encoding="utf-8"?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:prod="http://za.co.pepkor/product_service/"><soapenv:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
> soapenv:mustUnderstand="1"><wsu:Timestamp
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
> wsu:Id="Timestamp-1"><wsu:Created>2015-03-23T10:52:05.507Z</wsu:Created><wsu:Expires>2015-03-23T10:57:05.507Z</wsu:Expires></wsu:Timestamp></wsse:Security></soapenv:Header><soapenv:Body><prod:productSearchResp>
> <productDetails><noItemFound>No item in
> Ackerman's</noItemFound></productDetails><productDetails><productID>1452168</productID><productName>PUMPS</productName><productSize>7</productSize><productColour>ORANGE</productColour><productType>SHOE</productType><sourceID>SHC</sourceID></productDetails><productDetails><productID>1124596</productID><productName>REEBOK_SNEAKERS</productName><productSize>7</productSize><productColour>BROWN</productColour><productType>SHOES</productType><sourceID>SHC</sourceID></productDetails><productDetails><productID>1123456</productID><productName>NIKE_SHIRTS</productName><productSize>7</productSize><productColour>RED</productColour><productType>SHIRT</productType><sourceID>SHC</sourceID></productDetails>
> </prod:productSearchResp></soapenv:Body></soapenv:Envelope> Unexpected
> error sending message back {org.apache.synapse.core.axis2.Axis2Sender}
> org.apache.axis2.AxisFault: No user value in the rampart configuration
> policy at
> org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:76)
> 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.send(AxisEngine.java:426) at
> org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:163)
> at
> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:321)
> at
> org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:94)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
> at
> org.apache.synapse.config.xml.AnonymousListMediator.mediate(AnonymousListMediator.java:30)
> at
> org.apache.synapse.config.xml.SwitchCase.mediate(SwitchCase.java:66)
> at
> org.apache.synapse.mediators.filters.SwitchMediator.mediate(SwitchMediator.java:123)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
> at
> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
> at
> org.apache.synapse.mediators.eip.aggregator.AggregateMediator.completeAggregate(AggregateMediator.java:419)
> at
> org.apache.synapse.mediators.eip.aggregator.AggregateMediator.mediate(AggregateMediator.java:314)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
> at
> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
> at
> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:196)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
> at
> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
> at
> org.apache.synapse.mediators.eip.aggregator.AggregateMediator.completeAggregate(AggregateMediator.java:419)
> at
> org.apache.synapse.mediators.eip.aggregator.AggregateMediator.mediate(AggregateMediator.java:314)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
> at
> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
> at org.apache.synapse.mediators.eip.Target.mediate(Target.java:106)
> at
> org.apache.synapse.mediators.eip.splitter.IterateMediator.mediate(IterateMediator.java:146)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
> at
> org.apache.synapse.mediators.filters.FilterMediator.mediate(FilterMediator.java:160)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
> at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
> at
> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
> at
> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:261)
> at
> org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:488)
> at
> org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)
> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
> at
> org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:225)
> at
> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:745) Caused by:
> org.apache.rampart.RampartException: No user value in the rampart
> configuration policy at
> org.apache.rampart.builder.BindingBuilder.addUsernameToken(BindingBuilder.java:212)
> at
> org.apache.rampart.builder.TransportBindingBuilder.build(TransportBindingBuilder.java:95)
> at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:140)
> at
> org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
> ... 46 more
This is of course using the default policies. I tried editing the policy as follows (soap11binding level) :
<rampart:RampartConfig xmlns:rampart="http://ws.apache.org/rampart/policy">
<rampart:user>admin</rampart:user>
<rampart:timestampPrecisionInMilliseconds>true</rampart:timestampPrecisionInMilliseconds>
<rampart:timestampTTL>300</rampart:timestampTTL>
<rampart:timestampMaxSkew>300</rampart:timestampMaxSkew>
<rampart:timestampStrict>false</rampart:timestampStrict>
<rampart:tokenStoreClass>org.wso2.carbon.security.mypwhandler.PWCBHandler</rampart:tokenStoreClass>
<rampart:nonceLifeTime>300</rampart:nonceLifeTime>
</rampart:RampartConfig>
Where PWCBHandler =
package org.wso2.carbon.security.mypwhandler;
import java.io.IOException;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import org.apache.ws.security.WSPasswordCallback;
import org.wso2.carbon.user.core.UserStoreException;
import org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager;
public class PWCBHandler implements CallbackHandler {
private String all;
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
WSPasswordCallback pwcb = (WSPasswordCallback) callbacks[i];
int usage = pwcb.getUsage();
if (usage == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN) {
// verify uT password
if ("admin".equals(pwcb.getIdentifier())
&& "admin".equals(pwcb.getPassword())) {
return;
}
}
When I use the above handler , I get the following error:
AxisFault: No password supplied by the callback handler for the user : "admin"
Please assist me with this. I suspect it could be the service chaining aspect that might be causing the issue.
Other things I've tried :
Apply the above as a custom scenario policy , why does includes the keystore/trusted keystore option even though there is NO encryption taking place???
Another thing is why the default SecurityTokenStore is all commented out in the source code??? I cannot hit the above SecurityTokenStore in remote debug...
Proxy :
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="Product_Search_Proxy"
transports="https"
statistics="disable"
trace="disable"
startOnLoad="true">
<target outSequence="productSearchHandler">
<inSequence>
<switch source="$trp:Content-Type">
<case regex="text/xml;charset=UTF-8">
<property name="CallType" value="SOAP" scope="default" type="STRING"/>
<log level="custom">
<property name="Soap request read ..." value="sending..."/>
</log>
<log level="full" category="DEBUG" separator="____:::::____"/>
<clone>
<target sequence="ackProductSearchRq"/>
<target sequence="shcProductSearchRq"/>
</clone>
</case>
<case regex="application/json">
<property name="CallType" value="REST" scope="default" type="STRING"/>
<log level="custom">
<property name="REST or API request read ..." value="sending..."/>
</log>
<property name="messageType" value="text/xml" scope="axis2" type="STRING"/>
<log level="full" category="DEBUG" separator="____:::::____"/>
<property xmlns:ns="http://org.apache.synapse/xsd"
name="name"
expression="//productSearch/productName/text()"
scope="default"
type="STRING"/>
<property xmlns:ns="http://org.apache.synapse/xsd"
name="size"
expression="//productSearch/productSize/text()"
scope="default"
type="STRING"/>
<property xmlns:ns="http://org.apache.synapse/xsd"
name="colour"
expression="//productSearch/productColour/text()"
scope="default"
type="STRING"/>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:prod="http://za.co.pepkor/product_service/">
<soapenv:Body>
<prod:productSearchReq>
<productName xmlns="">$1</productName>
<productSize xmlns="">$2</productSize>
<productColour xmlns="">$3</productColour>
</prod:productSearchReq>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg xmlns:ns="http://org.apache.synapse/xsd"
evaluator="xml"
expression="$ctx:name"/>
<arg xmlns:ns="http://org.apache.synapse/xsd"
evaluator="xml"
expression="$ctx:size"/>
<arg xmlns:ns="http://org.apache.synapse/xsd"
evaluator="xml"
expression="$ctx:colour"/>
</args>
</payloadFactory>
<clone>
<target sequence="ackProductSearchRq"/>
<target sequence="shcProductSearchRq"/>
</clone>
</case>
<default/>
</switch>
</inSequence>
<faultSequence/>
</target>
<publishWSDL key="conf:/service_definitions/PepKorProductSearch.wsdl"/>
<parameter name="ScenarioID">scenario1</parameter>
<enableSec/>
<policy key="conf:/repository/axis2/service-groups/Product_Search_Proxy/services/Product_Search_Proxy/policies/UTOverTransport"/>
<description/>
</proxy>