graphdb.js | officially supported javascript driver for accessing RDF4J | Runtime Evironment library
kandi X-RAY | graphdb.js Summary
kandi X-RAY | graphdb.js Summary
A GraphDB and RDF4J data access library written in JavaScript to be used in Node.js.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of graphdb.js
graphdb.js Key Features
graphdb.js Examples and Code Snippets
Community Discussions
Trending Discussions on graphdb.js
QUESTION
I am aware that GraphDB itself provides several ways of authentication. Let's say I lock access to the GraphDB server and let only users with credentials access it. Let's say I create an authorized user with username and password.
I am using Node.js and in particular graphdb.js to establish an insecure connection. But how do I add the authentication between the communication from node server and graphdb server ? The documentation says:
If the library is going to be used against a secured server, then all API calls must be authenticated by sending an http authorization header with a token which is obtained after a call to rest/login/user_name with a password provided as a specific header. In case the server requires that requests should be authenticated, then in the ServerClientConfig and RepositoryClientConfig must be configured the username and password which to be used for the authentication. If those are provided, then the client assumes that authentication is mandatory and the login with the provided credentials is performed automatically before the first API call. After a successful login, user details which are received and the auth token are stored in the AuthenticationService. From that moment on, with every API call is sent also an authorization header with the token as value. If the token expires, then the first API call will be rejected with an http error with status 401. The client handles this automatically by re-login the user with the same credentials, updates the stored token and retries the API call. This behavior is the default and can be changed if the ServerClientConfig or RepositoryClientConfig are configured with keepAlive=false.
So what are the coding steps with sample code that need to be followed. I have not seen an example somewhere doing so. Can someone help please ?
...ANSWER
Answered 2019-Nov-06 at 13:56When security is enabled you have to authorize the request by passing JWT token. To receive a JWT token you can send a request as user admin. All examples are with curl for simplicity, but the idea would be the same.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install graphdb.js
Make sure prerequisites are covered: node js and npm must be present and versions should be supported.
Enter the project directory and execute
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page