2 Replies Latest reply on May 23, 2014 10:27 AM by Jon Kranes

    Problem with authenticated runtime access to kie workbench repo

    Jon Kranes Newbie

      I am trying to load jBPM workflows directly from the workbench server at runtime from within my application.  I had this working in 5.4 using a guvnor repository, but now am trying to convert over to the new maven-based deployment model in 6.0.


      I have built my workflows into a project and deployed this as a jar on the workbench server's artifact repository. I have configured my maven settings.xml with the necessary <repository> and <server> settings to add the workbench server as a remote repository, along with authentication configuration so that it will send pre-emptive Basic Authentication.


      If I declare the jar as a dependency in my project, and run a maven build, it successfully reaches out to the workbench server and finds the jar file, and I can see using Wireshark that the expected Basic Authentication is sent with the request.  So this seems to indicate my Maven environment settings are correct.


      However, if I try to directly access the jar file using the kie-ci library along with the following code:


      KieServices ks = KieServices.Factory.get();

      KieContainer kContainer = ks.newKieContainer(ks.newReleaseId("org.example.package", "artifact", "1.0"));


      then I get a 401 Unauthorized error because the Basic Authentication header is not sent.


      Here's what doesn't make sense to me:  I KNOW that the kie-ci component MUST be reading my settings.xml, because that's the only place the repository URL is set, and I can see from Wireshark that it is making a request to the repository to get the jar, but the request does not contain any authentication header. The same settings.xml file has the URL (in <repositories>) and the authentication (in <servers>) so it must be reading this file or it would not find the URL. If there were something wrong with the settings.xml then I would expect the maven build would not work.  So I am stumped as to what is wrong.


      Is it possible there could be a bug somewhere or configuration error in my project that causes the kie-ci to not correctly use the repository authentication info from the settings.xml even though it clearly is able to find the URL, and even though a standard maven build using the same settings.xml does correctly read and use the authentication info?


      Any help would be appreciated.