Schiller-Stoff / backend

The NAMPI backend based on Spring Boot and Apache Jena

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NAMPI Backend

This is the server backend and API for NAMPI.

Prerequesite

The NAMPI backend is a Spring Boot app, the data is stored in Apache Fuseki and the identity management is handled by Keycloak.

Keycloak

  • A new keycloak realm needs to be created using the default settings.
  • A new client has to be created using the default settings. (For the development environment Valid Redirect URIs can be set to *)
  • A role user for authenticated users has to be created.

Optional

Some users can be created for a development environment. They need to get at least the role user and a password assigned.

Fuseki

  • A stand alone fuseki instance has to be created.
  • A persistent new dataset needs to be created to store data.
  • In a development environment, some test data can be imported in the dataset.

Configuring the application

A number of command line parameters are available to configure the application.

Parameter Mandatory Default Value Example Description
APPLICATION_PORT 8080 The port the application will run on
CORE_OWL_URL https://raw.githubusercontent.com/nam-pi/ontologies/master/core.owl The location of the NAMPI-Core ontology
KEYCLOAK_URL * http://localhost:8080/auth/ The Keycloak URL
KEYCLOAK_REALM * nampi The name of the Keycloak realm
KEYCLOAK_RESOURCE * nampi-client The name of the Keycloak client
LOGGING_LEVEL INFO DEBUG The Spring Boot logging level
TRIPLE_STORE_URL * http://localhost:3030/nampi-data The Fuseki URL including the path to the dataset

Running the Spring Boot application

The application can be run from the command line using Maven, the environment parameters can be appended to the command.

Example

mvn spring-boot:run "'-Dspring-boot.run.arguments=--KEYCLOAK_URL=http://localhost:8081/auth,--KEYCLOAK_REALM=nampi,--KEYCLOAK_RESOURCE=nampi-client,--LOGGING_LEVEL=DEBUG,--TRIPLE_STORE_URL=http://localhost:3030/nampi-data'"

Requesting data

The application runs on the configured port, requests can be made using standard HTTP requests

Possible Accept Headers

  • None (Defaults to JSON-LD)
  • application/ld+json
  • application/n-triples
  • application/rdf+xml
  • text/turtle

Authentication

Protected endpoints like /users/search/current need to be accessed using a valid OAuth 2 Bearer Token Header Authorization: Bearer [Token]. The token can be acquired / refreshed in all ways configured in Keycloak. Examples are:

Resource Owner Credentials

Access Token Endpoint: [Keycloak URL]/realms/nampi/protocol/openid-connect/token

Authorization Code

Authorization Endpoint: [Keycloak URL]/auth/realms/nampi/protocol/openid-connect/auth Access Token Endpoint: [Keycloak URL]/auth/realms/nampi/protocol/openid-connect/token

About

The NAMPI backend based on Spring Boot and Apache Jena


Languages

Language:Java 100.0%