PolicyVerificationInInterceptor Inbound policy verification failed: These policy alternatives can not be satisfied WSS4J + CXF Client -
i'm implementing web service client in java uses apache cxf 3.1.1 + wss4j 2.2.1 ws-security running in jboss eap 6.3 environment.
i've setted following properties in wss4jininterceptor signature verification in following way:
org.apache.cxf.endpoint.client client = org.apache.cxf.frontend.clientproxy.getclient(service); org.apache.cxf.endpoint.endpoint cxfendpoint = client.getendpoint(); map<string,object> inprops = new hashmap<string,object>(); inprops.put(wshandlerconstants.action,wshandlerconstants.signature + " " + wshandlerconstants.timestamp + " "); inprops.put(wshandlerconstants.sig_prop_file, merlin.properties"); inprops.put(wshandlerconstants.dec_prop_file, "merlin.properties"); wss4jininterceptor wssin = new wss4jininterceptor(inprops); cxfendpoint.getininterceptors().add(wssin); try { result = call service... } in way got exception: [org.apache.cxf.ws.policy.policyverificationininterceptor] inbound policy verification failed: these policy alternatives can not satisfied:
{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}asymmetricbinding {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}initiatortoken {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}x509token {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}wssx509v3token10 {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}recipienttoken {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}algorithmsuite {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}basic128 {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}layout {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}strict {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}includetimestamp {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}onlysignentireheadersandbody {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}signedparts {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}supportingtokens {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}wssx509v3token10 the policy section of wsdl exposed server-side below:
<wsp:policy wsu:id="examplepolicy"> <sp:asymmetricbinding> <wsp:policy> <sp:initiatortoken> <wsp:policy> <sp:x509token sp:includetoken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/includetoken/once"> <wsp:policy> <sp:wssx509v3token10/> </wsp:policy> </sp:x509token> </wsp:policy> </sp:initiatortoken> <sp:recipienttoken> <wsp:policy> <sp:x509token sp:includetoken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/includetoken/once"> <wsp:policy> <sp:wssx509v3token10/> </wsp:policy> </sp:x509token> </wsp:policy> </sp:recipienttoken> <sp:algorithmsuite> <wsp:policy> <sp:basic128/> </wsp:policy> </sp:algorithmsuite> <sp:layout> <wsp:policy> <sp:strict/> </wsp:policy> </sp:layout> <sp:includetimestamp/> <sp:onlysignentireheadersandbody/> </wsp:policy> </sp:asymmetricbinding> <sp:signedparts> <sp:body/> </sp:signedparts> <sp:supportingtokens> <wsp:policy> <sp:x509token sp:includetoken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/includetoken/never"> <wsp:policy> <sp:wssx509v3token10/> </wsp:policy> </sp:x509token> </wsp:policy> </sp:supportingtokens> </wsp:policy> </wsdl:definitions>
you using non-policy aware wss4jininterceptor class. need use policybasedwss4jininterceptor class instead. note configured differently wss4jininterceptor. see here: http://cxf.apache.org/docs/ws-securitypolicy.html
Comments
Post a Comment