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

Feature: Allow for using bearer token with secured SPARQL endpoints #122

Open
seebi opened this issue Sep 9, 2022 · 1 comment
Open
Assignees

Comments

@seebi
Copy link
Member

seebi commented Sep 9, 2022

Expected Behavior

In the coypu project, we need to fetch data from graphs which are in SPARQL endpoints secured with OAUTH2 (client credential flow).

Given an available token, which is provided via an environment variable (e.g. RDFUNIT_BEARER_TOKEN), the expected behaviour of this feature is, that rdfunit uses this token to provide authentication to the endpoint.

This is basically as easy as adding the following header to all HTTP requests to the SPARQL endpoint:

Authorization: Bearer ${RDFUNIT_BEARER_TOKEN}

Reference: https://www.rfc-editor.org/rfc/rfc6750#section-2

Actual Behavior

rdfunit is not able to use token based authentication on endpoints

Test Environment

Given the following cmemc config, you can fetch a token as follows with cmemc.

$ cat cmemc.ini
[pm.coypu.org]
CMEM_BASE_URI=https://pm.coypu.org/
OAUTH_GRANT_TYPE=client_credentials
OAUTH_CLIENT_ID=cmem-service-account
OAUTH_CLIENT_SECRET=...

$ cmemc --config-file cmemc.ini -c pm.coypu.org admin token
[token here]

# authenticated
$ curl -H "Authorization: Bearer $(cmemc --config-file cmemc.ini -c pm.coypu.org admin token)" https://pm.coypu.org/dataplatform/proxy/default/sparql -G --data-urlencode "query=SELECT ?noop WHERE {BIND ('output' AS ?noop)}"
[query result here]

# NOT authenticated
$ curl https://pm.coypu.org/dataplatform/proxy/default/sparql -G --data-urlencode "query=SELECT ?noop WHERE {BIND ('output' AS ?noop)}"
{"title":"Unauthorized","status":401,"detail":"Full authentication is required to access this resource"}%

Team

@Aklakan will implement this
@mgns @rpietzsch and @seebi are happy to test this and provide feedback

What this request is not about

This request is not about how this token fetched from an identity provider.
Assuming the token is available is ok.

@mgns
Copy link

mgns commented Oct 12, 2022

Draft implementation of this feature in https://github.com/mgns/RDFUnit/tree/feature/bearerTokenSupport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants