Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CxfSoapClientIT.wsSecurityClient fails in native mode: wsse:Nonce not present in the request #3966

Closed
ppalaga opened this issue Aug 8, 2022 · 8 comments · Fixed by #3985
Closed
Assignees
Milestone

Comments

@ppalaga
Copy link
Contributor

ppalaga commented Aug 8, 2022

[INFO] Running org.apache.camel.quarkus.component.cxf.soap.it.CxfSoapClientIT
Aug 08, 2022 6:45:42 P.M. org.jboss.threads.Version <clinit>
INFO: JBoss Threads version 3.4.2.Final
Aug 08, 2022 6:45:42 P.M. org.apache.camel.quarkus.test.wiremock.WireMockTestResourceLifecycleManager createServer
INFO: Starting WireMockServer
Aug 08, 2022 6:45:42 P.M. org.apache.camel.quarkus.test.mock.backend.MockBackendUtils logMockBackendUsed
INFO: Mock backend will be used
2022-08-08 18:45:42,788 INFO  [org.ecl.jet.uti.log] (pool-2-thread-1) Logging initialized @2914ms to org.eclipse.jetty.util.log.Slf4jLog
2022-08-08 18:45:42,930 INFO  [org.ecl.jet.ser.Server] (pool-2-thread-1) jetty-9.4.48.v20220622; built: 2022-06-21T20:42:25.880Z; git: 6b67c5719d1f4371b33655ff2d047d24e171e49a; jvm 11.0.7+10
2022-08-08 18:45:42,950 INFO  [org.ecl.jet.ser.han.ContextHandler] (pool-2-thread-1) Started o.e.j.s.ServletContextHandler@452708ae{/__admin,null,AVAILABLE}
2022-08-08 18:45:42,952 INFO  [org.ecl.jet.ser.han.ContextHandler] (pool-2-thread-1) Started o.e.j.s.ServletContextHandler@1b6f967f{/,null,AVAILABLE}
2022-08-08 18:45:42,974 INFO  [org.ecl.jet.ser.AbstractConnector] (pool-2-thread-1) Started NetworkTrafficServerConnector@1a4e4007{HTTP/1.1, (http/1.1)}{0.0.0.0:43467}
2022-08-08 18:45:42,974 INFO  [org.ecl.jet.ser.Server] (pool-2-thread-1) Started @3102ms
Aug 08, 2022 6:45:42 P.M. org.apache.camel.quarkus.test.wiremock.WireMockTestResourceLifecycleManager start
INFO: WireMock started on http://localhost:43467
======================================================================================
  native.image.path was not set, making a guess for the correct path of native image
  guessed path: /home/ppalaga/orgs/cq/camel-quarkus/integration-tests/cxf-soap/target/camel-quarkus-integration-test-cxf-soap-2.12.0-SNAPSHOT-runner
======================================================================================
Executing "/home/ppalaga/orgs/cq/camel-quarkus/integration-tests/cxf-soap/target/camel-quarkus-integration-test-cxf-soap-2.12.0-SNAPSHOT-runner -Dquarkus.http.port=46627 -Dquarkus.http.ssl-port=40793 -Dtest.url=http://localhost:46627 -Dquarkus.log.file.path=/home/ppalaga/orgs/cq/camel-quarkus/integration-tests/cxf-soap/target/quarkus.log -Dquarkus.log.file.enable=true -Dwiremock.url=http://localhost:43467"
2022-08-08 18:45:43,092 ERROR [io.qua.cxf.tra.CxfHandler] (main) Cannot initialize Web Service org.apache.camel.component.cxf.jaxws.DefaultPayloadProviderSEI on /soapservice
2022-08-08 18:45:43,094 INFO  [org.apa.cam.qua.cor.CamelBootstrapRecorder] (main) Bootstrap runtime: org.apache.camel.quarkus.main.CamelMainRuntime
2022-08-08 18:45:43,094 INFO  [org.apa.cam.mai.MainSupport] (main) Apache Camel (Main) 3.18.0 is starting
2022-08-08 18:45:43,104 INFO  [org.apa.cam.mai.BaseMainSupport] (main) Binding bean: loggingFeature (type: org.apache.cxf.ext.logging.LoggingFeature) to the registry
2022-08-08 18:45:43,105 INFO  [org.apa.cam.mai.BaseMainSupport] (main) Binding bean: wssArgs (type: java.util.HashMap) to the registry
2022-08-08 18:45:43,105 INFO  [org.apa.cam.mai.BaseMainSupport] (main) Binding bean: wssInterceptor (type: org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor) to the registry
2022-08-08 18:45:43,105 INFO  [org.apa.cam.mai.BaseMainSupport] (main) Binding bean: codeFirstServiceEndpoint (type: org.apache.camel.component.cxf.jaxws.CxfEndpoint) to the registry
2022-08-08 18:45:43,106 INFO  [org.apa.cam.mai.BaseMainSupport] (main) Binding bean: secureEndpoint (type: org.apache.camel.component.cxf.jaxws.CxfEndpoint) to the registry
2022-08-08 18:45:43,106 INFO  [org.apa.cam.mai.BaseMainSupport] (main) Binding bean: soapClientEndpoint (type: org.apache.camel.component.cxf.jaxws.CxfEndpoint) to the registry
2022-08-08 18:45:43,106 INFO  [org.apa.cam.mai.BaseMainSupport] (main) Binding bean: soapServiceEndpoint (type: org.apache.camel.component.cxf.jaxws.CxfEndpoint) to the registry
2022-08-08 18:45:43,108 INFO  [org.apa.cam.mai.BaseMainSupport] (main) Auto-configuration summary
2022-08-08 18:45:43,108 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.codeFirstServiceEndpoint.features[0]=#bean:loggingFeature
2022-08-08 18:45:43,108 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.codeFirstServiceEndpoint.address=/codefirst
2022-08-08 18:45:43,108 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.codeFirstServiceEndpoint.serviceClass=com.helloworld.service.CodeFirstService
2022-08-08 18:45:43,108 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.soapServiceEndpoint.serviceClass=com.helloworld.service.HelloPortType
2022-08-08 18:45:43,108 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.soapServiceEndpoint.wsdlURL=wsdl/HelloService.wsdl
2022-08-08 18:45:43,108 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.soapServiceEndpoint.features[0]=#bean:loggingFeature
2022-08-08 18:45:43,108 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.soapServiceEndpoint.address=/hello
2022-08-08 18:45:43,108 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.wssArgs.passwordType=PasswordText
2022-08-08 18:45:43,108 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.wssArgs.user=xxxxxx
2022-08-08 18:45:43,109 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.wssArgs.passwordCallbackRef=#bean:passwordCallback
2022-08-08 18:45:43,109 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.wssArgs.addUsernameTokenNonce=true
2022-08-08 18:45:43,109 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.wssArgs.action=UsernameToken
2022-08-08 18:45:43,109 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.wssArgs.addUsernameTokenCreated=true
2022-08-08 18:45:43,109 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.soapClientEndpoint.wsdlURL=wsdl/HelloService.wsdl
2022-08-08 18:45:43,109 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.soapClientEndpoint.address=http://localhost:43467/hello
2022-08-08 18:45:43,109 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.soapClientEndpoint.serviceClass=com.helloworld.service.HelloPortType
2022-08-08 18:45:43,109 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.soapClientEndpoint.features[0]=#bean:loggingFeature
2022-08-08 18:45:43,109 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.secureEndpoint.outInterceptors[0]=#bean:wssInterceptor
2022-08-08 18:45:43,109 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.secureEndpoint.serviceClass=com.helloworld.service.HelloPortType
2022-08-08 18:45:43,109 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.secureEndpoint.address=http://localhost:43467/hellowss
2022-08-08 18:45:43,109 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.secureEndpoint.wsdlURL=wsdl/HelloService.wsdl
2022-08-08 18:45:43,109 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.secureEndpoint.features[0]=#bean:loggingFeature
2022-08-08 18:45:43,109 INFO  [org.apa.cam.mai.BaseMainSupport] (main)     [MicroProfilePropertiesSource] camel.beans.loggingFeature.prettyLogging=true
2022-08-08 18:45:43,111 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 3.18.0 (camel-1) is starting
2022-08-08 18:45:43,113 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.bindings.xformat.XMLBindingMessageFormat
2022-08-08 18:45:43,113 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.bindings.xformat.XMLBindingMessageFormat
2022-08-08 18:45:43,113 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.bindings.xformat.XMLFormatBinding
2022-08-08 18:45:43,114 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.transports.http.configuration.HTTPClientPolicy
2022-08-08 18:45:43,114 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.transports.http.configuration.HTTPServerPolicy
2022-08-08 18:45:43,114 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.wsdl.http.AddressType
2022-08-08 18:45:43,114 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.ws.addressing.wsdl.UsingAddressing
2022-08-08 18:45:43,120 WARN  [org.apa.cxf.fro.AbstractWSDLBasedEndpointFactory] (main) Could not find endpoint/port for {http://www.helloworld.com/Service/}HelloPortTypePort in wsdl. Using {http://www.helloworld.com/Service/}HelloPort.
2022-08-08 18:45:43,122 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.bindings.xformat.XMLBindingMessageFormat
2022-08-08 18:45:43,123 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.bindings.xformat.XMLBindingMessageFormat
2022-08-08 18:45:43,123 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.bindings.xformat.XMLFormatBinding
2022-08-08 18:45:43,123 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.transports.http.configuration.HTTPClientPolicy
2022-08-08 18:45:43,123 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.transports.http.configuration.HTTPServerPolicy
2022-08-08 18:45:43,123 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.wsdl.http.AddressType
2022-08-08 18:45:43,124 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.ws.addressing.wsdl.UsingAddressing
2022-08-08 18:45:43,127 WARN  [org.apa.cxf.fro.AbstractWSDLBasedEndpointFactory] (main) Could not find endpoint/port for {http://www.helloworld.com/Service/}HelloPortTypePort in wsdl. Using {http://www.helloworld.com/Service/}HelloPort.
2022-08-08 18:45:43,128 WARN  [org.apa.cxf.fro.AbstractWSDLBasedEndpointFactory] (main) Could not find endpoint/port for {http://www.helloworld.com/Service/}HelloPortTypePort in wsdl. Using {http://www.helloworld.com/Service/}HelloPort.
2022-08-08 18:45:43,129 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.bindings.xformat.XMLBindingMessageFormat
2022-08-08 18:45:43,130 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.bindings.xformat.XMLBindingMessageFormat
2022-08-08 18:45:43,130 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.bindings.xformat.XMLFormatBinding
2022-08-08 18:45:43,130 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.transports.http.configuration.HTTPClientPolicy
2022-08-08 18:45:43,130 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.transports.http.configuration.HTTPServerPolicy
2022-08-08 18:45:43,130 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.wsdl.http.AddressType
2022-08-08 18:45:43,131 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.ws.addressing.wsdl.UsingAddressing
2022-08-08 18:45:43,133 WARN  [org.apa.cxf.fro.AbstractWSDLBasedEndpointFactory] (main) Could not find endpoint/port for {http://www.helloworld.com/Service/}HelloPortTypePort in wsdl. Using {http://www.helloworld.com/Service/}HelloPort.
2022-08-08 18:45:43,133 INFO  [org.apa.cxf.end.ServerImpl] (main) Setting the server's publish address to be /hello
2022-08-08 18:45:43,135 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.bindings.xformat.XMLBindingMessageFormat
2022-08-08 18:45:43,136 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.bindings.xformat.XMLBindingMessageFormat
2022-08-08 18:45:43,136 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.bindings.xformat.XMLFormatBinding
2022-08-08 18:45:43,136 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.transports.http.configuration.HTTPClientPolicy
2022-08-08 18:45:43,136 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.transports.http.configuration.HTTPServerPolicy
2022-08-08 18:45:43,137 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.wsdl.http.AddressType
2022-08-08 18:45:43,137 INFO  [org.apa.cxf.wsd.ExtensionClassGenerator] (main) extensibility class substitute: org.apache.cxf.ws.addressing.wsdl.UsingAddressing
2022-08-08 18:45:43,138 INFO  [org.apa.cxf.end.ServerImpl] (main) Setting the server's publish address to be /codefirst
2022-08-08 18:45:43,138 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Routes startup (started:5)
2022-08-08 18:45:43,138 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main)     Started route1 (direct://simpleSoapClient)
2022-08-08 18:45:43,138 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main)     Started route2 (direct://wsSecurityClient)
2022-08-08 18:45:43,138 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main)     Started route3 (direct://complexSoapClient)
2022-08-08 18:45:43,138 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main)     Started route4 (cxf://bean:soapServiceEndpoint)
2022-08-08 18:45:43,138 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main)     Started route5 (cxf://bean:codeFirstServiceEndpoint)
2022-08-08 18:45:43,138 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 3.18.0 (camel-1) started in 28ms (build:0ms init:1ms start:27ms)
2022-08-08 18:45:43,143 INFO  [io.quarkus] (main) camel-quarkus-integration-test-cxf-soap 2.12.0-SNAPSHOT native (powered by Quarkus 2.11.1.Final) started in 0.080s. Listening on: http://0.0.0.0:46627
2022-08-08 18:45:43,143 INFO  [io.quarkus] (main) Profile prod activated. 
2022-08-08 18:45:43,143 INFO  [io.quarkus] (main) Installed features: [camel-core, camel-cxf-soap, camel-direct, cdi, cxf, resteasy, smallrye-context-propagation, vertx]
2022-08-08 18:45:44,165 INFO  [org.apa.cxf.ser.Hel.REQ_OUT] (executor-thread-0) REQ_OUT
    Address: http://localhost:43467/hellowss
    HttpMethod: POST
    Content-Type: text/xml
    ExchangeId: 617ee436-0c6f-445b-9799-9a6bd019a557
    ServiceName: HelloService
    PortName: HelloPort
    PortTypeName: HelloPortType
    Headers: {SOAPAction="https://www.helloworld.com/Service/Hello", Accept=*/*}
    Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soap:mustUnderstand="1">
      <wsse:UsernameToken wsu:Id="UsernameToken-559a968c-708d-4630-9aff-fbc5a59dcc53">
        <wsse:Username>camel</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">quarkus</wsse:Password>
        <wsu:Created>2022-08-08T16:45:44.164Z</wsu:Created>
      </wsse:UsernameToken>
    </wsse:Security>
  </soap:Header>
  <soap:Body>
    <ns2:HelloRequest xmlns:ns2="http://www.helloworld.com/Service/">CamelQuarkusCXF</ns2:HelloRequest>
  </soap:Body>
</soap:Envelope>


2022-08-08 18:45:44,257 INFO  [org.ecl.jet.ser.han.Con.ROOT] (qtp1288155188-35) RequestHandlerClass from context returned com.github.tomakehurst.wiremock.http.StubRequestHandler. Normalized mapped under returned 'null'
2022-08-08 18:45:44,379 INFO  [org.ecl.jet.ser.han.Con.__admin] (qtp1288155188-35) RequestHandlerClass from context returned com.github.tomakehurst.wiremock.http.AdminRequestHandler. Normalized mapped under returned 'null'
2022-08-08 18:45:44,535 ERROR [WireMock] (qtp1288155188-35) 
                                               Request was not matched
                                               =======================

-----------------------------------------------------------------------------------------------------------------------
| Closest stub                                             | Request                                                  |
-----------------------------------------------------------------------------------------------------------------------
                                                           |
POST                                                       | POST
/hellowss                                                  | /hellowss
                                                           |
Content-Type: text/xml; charset=UTF-8                      | Content-Type: text/xml; charset=UTF-8
SOAPAction: "https://www.helloworld.com/Service/Hello"     | SOAPAction: "https://www.helloworld.com/Service/Hello"
                                                           |
//wsse:Nonce                                               | <soap:Envelope                                      <<<<< Body does not match
                                                           | xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><s
                                                           | oap:Header><wsse:Security
                                                           | xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-
                                                           | 200401-wss-wssecurity-secext-1.0.xsd"
                                                           | xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-2
                                                           | 00401-wss-wssecurity-utility-1.0.xsd"
                                                           | soap:mustUnderstand="1"><wsse:UsernameToken
                                                           | wsu:Id="UsernameToken-559a968c-708d-4630-9aff-fbc5a59dcc5
                                                           | 3"><wsse:Username>camel</wsse:Username><wsse:Password
                                                           | Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401
                                                           | -wss-username-token-profile-1.0#PasswordText">quarkus</ws
                                                           | se:Password><wsu:Created>2022-08-08T16:45:44.164Z</wsu:Cr
                                                           | eated></wsse:UsernameToken></wsse:Security></soap:Header>
                                                           | <soap:Body><ns2:HelloRequest
                                                           | xmlns:ns2="http://www.helloworld.com/Service/">CamelQuark
                                                           | usCXF</ns2:HelloRequest></soap:Body></soap:Envelope>
                                                           |
-----------------------------------------------------------------
@javaduke
Copy link
Contributor

javaduke commented Aug 8, 2022

It looks like for whatever reason in native mode the camel.beans.wssArgs.addUsernameTokenNonce=true is ignored. I still have no idea why, but I'm investigating.

@javaduke
Copy link
Contributor

javaduke commented Aug 8, 2022

The nonce token generation is line 516 of the WSHandler class which is the parent class in the hierarchy WSHandler -> AbstractWSS4JInterceptor -> WSS4JOutInterceptor. So the question is how do we debug it in the native mode and ensure that the property is set and this code is reached.

@javaduke
Copy link
Contributor

javaduke commented Aug 8, 2022

Also see UsernameTokenAction line 61.

@ppalaga ppalaga changed the title CxfSoapClientIT.wsSecurityClient fails in native mode: wsse:Nonce on present in the request CxfSoapClientIT.wsSecurityClient fails in native mode: wsse:Nonce not present in the request Aug 8, 2022
@javaduke
Copy link
Contributor

javaduke commented Aug 9, 2022

I tried creating a @Producer instead of the configuration in application.properties but running into the same issue. I still have no idea how to troubleshoot it...

@ppalaga
Copy link
Contributor Author

ppalaga commented Aug 9, 2022

I have built github.com/apache/ws-wss4j from source after adding some debug output. The problem seems to be that there is a WSSecurityException swallowed in org.apache.wss4j.dom.message.token.UsernameToken.addNonce(Document) which in turn is caused by a non-initialized secure random in org.apache.xml.security.stax.ext.XMLSecurityConstants of org.apache.santuario:xmlsec which we already handle in camel-quarkus-xmlsecurity. I'll have to figure out what should we recommend to end users.

@javaduke
Copy link
Contributor

javaduke commented Aug 9, 2022

Could it be related to this: https://github.com/quarkiverse/quarkus-cxf/blob/master/ws-security/runtime/src/main/java/io/quarkiverse/cxf/graal/CxfWsSecuritySubstitutions.java#L92

I tried to initialize it at the runtime, and I traced the class initialization and here's what I saw:

com.oracle.svm.core.util.UserError$UserException: The class org.apache.xml.security.stax.ext.XMLSecurityConstants has already been initialized (from feature io.quarkus.runner.Feature.beforeAnalysis with 'XMLSecurityConstants.class'); it is too late to register org.apache.xml.security.stax.ext.XMLSecurityConstants for build-time initialization. io.quarkiverse.cxf.graal.Target_org_apache_xml_security_stax_ext_XMLSec caused initialization of this class with the following trace: 
        at org.apache.xml.security.stax.ext.XMLSecurityConstants.<clinit>(XMLSecurityConstants.java:51)
        at org.apache.wss4j.stax.setup.WSSec.<clinit>(WSSec.java:64)
        at io.quarkiverse.cxf.graal.Target_org_apache_xml_security_stax_ext_XMLSec.<clinit>(CxfWsSecuritySubstitutions.java:51)

        at com.oracle.svm.core.util.UserError.abort(UserError.java:73)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.initializeAtRunTime(ConfigurableClassInitialization.java:272)
        at org.graalvm.sdk/org.graalvm.nativeimage.hosted.RuntimeClassInitialization.initializeAtRunTime(RuntimeClassInitialization.java:99)
        at io.quarkus.runner.Feature.beforeAnalysis(Unknown Source)
    ...

Not sure how to address this though...

@javaduke
Copy link
Contributor

@ppalaga Good news, we made a slight change in the Quarkus CXF and now all tests pass correctly and nonce is generated properly. What is the next scheduled date for the Camel Quarkus release? We should coordinate the Quarkus CXF release date so that we can update the version and reenable the test in native mode.

ppalaga added a commit to ppalaga/camel-quarkus that referenced this issue Aug 10, 2022
@ppalaga
Copy link
Contributor Author

ppalaga commented Aug 10, 2022

Thanks @javaduke , I have a temporary fix for Camel Quarkus. I'd like to check whether the substitutions in quarkus-cxf are really required. They are rather hard to maintain in the long term so other solutions should be preferred.

ppalaga added a commit to ppalaga/camel-quarkus that referenced this issue Aug 11, 2022
ppalaga added a commit to ppalaga/camel-quarkus that referenced this issue Aug 11, 2022
ppalaga added a commit to ppalaga/camel-quarkus that referenced this issue Aug 11, 2022
ppalaga added a commit that referenced this issue Aug 12, 2022
@ppalaga ppalaga added this to the 2.12.0 milestone Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants