Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 64918200B6F for ; Tue, 9 Aug 2016 11:36:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 63343160AA4; Tue, 9 Aug 2016 09:36:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 88A83160AA5 for ; Tue, 9 Aug 2016 11:36:21 +0200 (CEST) Received: (qmail 76298 invoked by uid 500); 9 Aug 2016 09:36:20 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 76286 invoked by uid 99); 9 Aug 2016 09:36:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Aug 2016 09:36:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 9175E2C0003 for ; Tue, 9 Aug 2016 09:36:20 +0000 (UTC) Date: Tue, 9 Aug 2016 09:36:20 +0000 (UTC) From: "Freeman Fang (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (CXF-6991) WS-RM - Request context properties are lost when sending subsequent protocol message MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 09 Aug 2016 09:36:22 -0000 [ https://issues.apache.org/jira/browse/CXF-6991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15413287#comment-15413287 ] Freeman Fang edited comment on CXF-6991 at 8/9/16 9:36 AM: ----------------------------------------------------------- Hi Tomohisa, Because we need add the properties to the endpoint but not for a specific invocation with a specific client, and the correct way to add the properties to the endpoint is like {code} client.getEndpoint().getEndpointInfo().getProperties().putAll(properties); {code} Actually the testContextProperty should be like this, no explicit invocationContext needed at all, this is equivalent as the spring properties configuration IMO. {code} @Test public void testContextProperty() throws Exception { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/apache/cxf/systest/ws/rm/sec/client-policy.xml"); Greeter greeter = (Greeter)context.getBean("GreeterCombinedClientNoProperty"); Client client = ClientProxy.getClient(greeter); QName operationQName = new QName("http://cxf.apache.org/greeter_control", "greetMe"); BindingOperationInfo boi = client.getEndpoint().getBinding().getBindingInfo().getOperation(operationQName); Map properties = new HashMap(); properties.put("ws-security.username", "Alice"); properties.put("ws-security.callback-handler", "org.apache.cxf.systest.ws.rm.sec.UTPasswordCallback"); properties.put("ws-security.encryption.properties", "bob.properties"); properties.put("ws-security.encryption.username", "bob"); properties.put("ws-security.signature.properties", "alice.properties"); properties.put("ws-security.signature.username", "alice"); client.getEndpoint().getEndpointInfo().getProperties().putAll(properties); GreetMe param = new GreetMe(); param.setRequestType("testContextProperty"); Object[] answer = client.invoke(boi, new Object[]{param}); Assert.assertEquals("TESTCONTEXTPROPERTY", answer[0].toString()); System.out.println("Waiting 5 secs..."); Thread.sleep(5000); } {code} Freeman was (Author: ffang): Hi Tomohisa, Because we need add the properties to the endpoint but not for a specific invocation with a specific client, and the correct way to add the properties to the endpoint is like {code} client.getEndpoint().getEndpointInfo().getProperties().putAll(properties); {code} Actually the testContextProperty should be like, this is equivalent as the spring properties configuration IMO. {code} @Test public void testContextProperty() throws Exception { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/apache/cxf/systest/ws/rm/sec/client-policy.xml"); Greeter greeter = (Greeter)context.getBean("GreeterCombinedClientNoProperty"); Client client = ClientProxy.getClient(greeter); QName operationQName = new QName("http://cxf.apache.org/greeter_control", "greetMe"); BindingOperationInfo boi = client.getEndpoint().getBinding().getBindingInfo().getOperation(operationQName); Map properties = new HashMap(); properties.put("ws-security.username", "Alice"); properties.put("ws-security.callback-handler", "org.apache.cxf.systest.ws.rm.sec.UTPasswordCallback"); properties.put("ws-security.encryption.properties", "bob.properties"); properties.put("ws-security.encryption.username", "bob"); properties.put("ws-security.signature.properties", "alice.properties"); properties.put("ws-security.signature.username", "alice"); client.getEndpoint().getEndpointInfo().getProperties().putAll(properties); GreetMe param = new GreetMe(); param.setRequestType("testContextProperty"); Object[] answer = client.invoke(boi, new Object[]{param}); Assert.assertEquals("TESTCONTEXTPROPERTY", answer[0].toString()); System.out.println("Waiting 5 secs..."); Thread.sleep(5000); } {code} Freeman > WS-RM - Request context properties are lost when sending subsequent protocol message > ------------------------------------------------------------------------------------ > > Key: CXF-6991 > URL: https://issues.apache.org/jira/browse/CXF-6991 > Project: CXF > Issue Type: Bug > Components: WS-* Components > Affects Versions: 2.7.18, 3.1.7 > Reporter: Tomohisa Igarashi > Assignee: Freeman Fang > Attachments: cxf-ws-rm-context-property.tgz > > > We hit "No SAML CallbackHandler available" error when it's sending TerminateSequence. > {code} > 20:44:32,416 SEVERE [org.apache.cxf.ws.rm.Proxy] (default-workqueue-1) Failed to send RM protocol message {http://schemas.xmlsoap.org/ws/2005/02/rm}TerminateSequence.: org.apache.cxf.interceptor.Fault: No SAML CallbackHandler available > at org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.doSignBeforeEncrypt(AsymmetricBindingHandler.java:198) [cxf-rt-ws-security-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.handleBinding(AsymmetricBindingHandler.java:98) [cxf-rt-ws-security-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:176) [cxf-rt-ws-security-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:90) [cxf-rt-ws-security-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) [cxf-api-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:572) [cxf-api-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:481) [cxf-api-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:393) [cxf-api-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.ws.rm.Proxy.invoke(Proxy.java:295) [cxf-rt-ws-rm-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.ws.rm.Proxy.terminate(Proxy.java:101) [cxf-rt-ws-rm-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.ws.rm.SourceSequence.setAcknowledged(SourceSequence.java:159) [cxf-rt-ws-rm-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.ws.rm.RMInInterceptor.processAcknowledgments(RMInInterceptor.java:191) [cxf-rt-ws-rm-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.ws.rm.RMInInterceptor.handle(RMInInterceptor.java:163) [cxf-rt-ws-rm-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.ws.rm.AbstractRMInterceptor.handleMessage(AbstractRMInterceptor.java:83) [cxf-rt-ws-rm-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) [cxf-api-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:831) [cxf-api-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1642) [cxf-rt-transports-http-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1133) [cxf-rt-transports-http-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428) [cxf-api-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_101] > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_101] > at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353) [cxf-api-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_101] > Caused by: org.apache.cxf.ws.policy.PolicyException: No SAML CallbackHandler available > at org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.policyNotAsserted(AbstractBindingBuilder.java:315) [cxf-rt-ws-security-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.addSamlToken(AbstractBindingBuilder.java:923) [cxf-rt-ws-security-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.handleSupportingTokens(AbstractBindingBuilder.java:571) [cxf-rt-ws-security-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.handleSupportingTokens(AbstractBindingBuilder.java:455) [cxf-rt-ws-security-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.addSupportingTokens(AbstractBindingBuilder.java:2139) [cxf-rt-ws-security-2.7.18.redhat-1.jar:2.7.18.redhat-1] > at org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.doSignBeforeEncrypt(AsymmetricBindingHandler.java:144) [cxf-rt-ws-security-2.7.18.redhat-1.jar:2.7.18.redhat-1] > ... 22 more > {code} > This is strange as CreateSequence and application message are successfully sent prior to this. It seems like the ws-security.* properties are lost when sending TerminateSequence while it's available for CreateSequence. Note that we pass those ws-security.* properties as request context property passed into org.apache.cxf.endpoint.Client.invoke() as a parameter using camel-cxf producer. > I'll attach a unit test soon. -- This message was sent by Atlassian JIRA (v6.3.4#6332)