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

Please pass configured settings for request headers to all AJAX requests. #448

Closed
elasticjava opened this issue Feb 3, 2023 · 5 comments
Labels
kind: Enhancement 📈 New feature or request what: Configuration Related to how the component is configured what: Widgets Related to component value selection widgets

Comments

@elasticjava
Copy link

elasticjava commented Feb 3, 2023

Working with secured SPARQL Endpoints I cannot pass authentication and request headers to all used requests.

In particular, the autocompletewidget uses its own AJAX requests, which do not inherit the configured properties of the Yasqe configuration.

It would be great if the Yasqe configuration could also be done via Typescript.

From a certain size of the created combined SPARQL query GET request are unsuitable.
So it would be great if that could be configurable as well.

@tfrancart
Copy link
Contributor

Yes I agree. This was registered as an issue in #187 .
I don't have yet a clear idea on what would be the best architecture for this.

@tfrancart tfrancart added kind: Enhancement 📈 New feature or request what: Widgets Related to component value selection widgets what: Configuration Related to how the component is configured labels Feb 3, 2023
@SteinerPascal
Copy link
Collaborator

SteinerPascal commented Feb 6, 2023

@tfrancart should i add an option to adapt the datasource property? From
"datasource": "datasources:list_rdfslabel_alpha_with_count",
To:

"datasources": {
    "labelProperty" : "http://www.w3.org/2000/01/rdf-schema#label",
    "sparqlEndpointUrl" : "http://non-default-endpoint.com",
    "queryTemplate":"list_rdfslabel_alpha_with_count",
    "method":"POST",
    "auth":{
    "scheme":"basic",
    "parameters": [
        "credentials": "YWxhZGRpbjpvcGVuc2VzYW1l"
      ]
  }

or for digest auth:

"datasources": {
    "labelProperty" : "http://www.w3.org/2000/01/rdf-schema#label",
    "sparqlEndpointUrl" : "http://non-default-endpoint.com",
    "queryTemplate":"list_rdfslabel_alpha_with_count",
    "method":"POST",
    "auth":{
    "scheme":"digest",
    "parameters": [
        "realm": "<realm>",
        " uri":"<url>",
        "algorithm":"<algorithm>",
        "etc": "..."
      ]
 }

Advantages:

  • Allows to define a different auth for different datasources.
  • flexible to adjust for other kinds oth auths
  • All datasource options are in one place

Disadvantages:

  • Credentials need to be known beforehand or otherwise sparnatural config needs to be adapted and sparnatural restarted.
  • Not easily synchronizable with Yasqe

@tfrancart
Copy link
Contributor

Salut @SteinerPascal

@tfrancart should i add an option to adapt the datasource property?

I don't think this should belong to the configuration. The configuration is meant to be "purely" semantic, with the definitions and mappings to classes and properties - and to queries to populate the lists. But the gory auth details of how to authenticate to SPARQL endpoints belong to another level. Typically you can have an ontologist designing the config, and a programmer or devops configuring the auth details.

Besides, this can be easily written in JSON but doing it in OWL (or future SHACL) config would require creating corresponding properties in the config-core or config-datasources ontologies.

What I suggest is to instead pass it as a pure JSON object to Sparnatural, as a map of endpoint/options, something like:

{
  "http://non-default-endpoint.com" : {
    "method":"POST",
    "auth":{
      "scheme":"digest",
      "parameters": [
        "realm": "<realm>",
        " uri":"<url>",
        "algorithm":"<algorithm>",
        "etc": "..."
      ]
  },
 "http://another-endpoint.com" : {
    // other configs for another endpoint
  }
}

I don't know if it is possible, but we could use exactly the same structure as for YasQE, so that the same config object can be used for both (?)

Then, when issuing queries, we can use the options provided to issue the request, like at

So - pretty much what you propose, but not in the config and passed as pure technical parameters to the Sparnatural element.

@tfrancart
Copy link
Contributor

Done in #517

@tfrancart
Copy link
Contributor

This is now done. The only place where headers are not passed is the initial call to load the configuration file (see #529 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: Enhancement 📈 New feature or request what: Configuration Related to how the component is configured what: Widgets Related to component value selection widgets
Projects
None yet
Development

No branches or pull requests

3 participants