Search code examples
javajenavirtuosojava-http-client

Jena 4 connection to Virtuoso


How can I access authenticated Virtuoso OpenSource SPARQL 1.1. graph store protocol through Jena 4? I am facing this problem after having upgraded my codebase from Jena 3 (Apache HttpClient) to Jena 4 (JDK11 HttpClient):

I am thinking about the following directions to solve the issue:

  • implement complete digest authentication challenge in JDK11 HttpClient. As a starting point I found this question.
  • connect to Virtuoso using Virtuoso Jena driver
  • switch to another http library (and possibly abandon Jena here)

Since all the options are non-trivial (either in efforts or in impact on the codebase) I would be glad to hear any other suggestions how to go forward. Thanks in advance!


Solution

  • Apache Jena applies digest authentication if the challenge response asks for it.

    https://jena.apache.org/documentation/sparql-apis/http-auth.html#jdk-httpclientauthenticator

    This is separate from use of JDK HttpClient.

    Jena can also be apply digest authentication on a connection in case 401 (challenge response) isn't given but instead only 403 is. This shouldn't be necessary.