This repository contains an example implementation of a SPARQL proxy, which can be used to restrict access to any SPARQL endpoint.
More information can be found at:
- Prototyp «Linked Data» natürliche Personen (Bundeskanzlei DTI)
- Dezentrale Personenstammdaten mit Linked Data (Bern University of Applied Sciences)
The following describes the structure and usage of the authorization proxy.
Install the necessary dependencies using Node Package Manager.
cd ld-prototype-proxy/proxy
npm install
Start the proxy using Node, by providing a configuration and a port (default is 3000).
cd ld-prototype-proxy/proxy
node ./main.js ../config/upi --port 3001
Alternatively a preconfigured proxy for the EWR and UPI endpoints can be started via Node Package Manager.
cd ld-prototype-proxy/proxy
npm run proxy-ewr
npm run proxy-upi
-
The provided configuration expects the EWR and UPI endpoints to be running under
http://localhost:8000/
andhttp://localhost:8001/
respectively. -
The proxy endpoints are published under
http://localhost:3000/sparql
andhttp://localhost:3001/sparql
. -
Additionally the proxy provides a web interface under
http://localhost:3000/
to issue SPARQL requests to itself.
The current version of the proxy does not yet feature any authentication methods.
For demonstration purposes a user's role can be provided directly in the following two ways.
- By specifying a default role on start-up with the
--role
option. e.g.node ../config/upi --port 3001 --role admin
- By specifying the
role
header of the request.
The logging output is disabled by default. To enable it, set the following environment variable before starting the proxy.
Powershell:
$env:DEBUG='proxy:*'
The following example shows the necessary steps to setup the proxy for the EWR and UPI endpoints.
-
Start the EWR and UPI triple store servers from ld-prototype-data.
cd ld-prototype-data/UC-Serafe/client-POC ./startEWR.sh ./startUPI.sh
-
Start the proxy as described above.
cd ld-prototype-proxy/proxy npm run proxy-ewr npm run proxy-upi
-
To test the proxy run the client script from ld-prototype-data with the following arguments.
cd ld-prototype-data/UC-Serafe/client-POC python3 serafe_sparql_query.py --queryNumber 5 --ewr_endpoint http://localhost:3000/sparql/ --upi_endpoint http://localhost:3001/sparql/
Note
The proxy is unable to execute federated queries.
This project uses the following third-party libraries:
- Repository: YASGUI on GitHub
- License: MIT License