cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Freeman Fang (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CXF-6991) WS-RM - Request context properties are lost when sending subsequent protocol message
Date Tue, 09 Aug 2016 09:36:20 GMT

    [ 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<String, Object> properties = new HashMap<String, Object>();
        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<String, Object> properties = new HashMap<String, Object>();
        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)

Mime
View raw message