Skip to content

Latest commit

 

History

History
283 lines (217 loc) · 7.34 KB

File metadata and controls

283 lines (217 loc) · 7.34 KB

  Digital Product Pass Backend

Version: v2.0.1


Table of contents

What is this backend app responsible for?

This backend includes the services and logics to manage the passports of the frontend app.

Services Available

Authentication Services

All Authenticated APIs required a AccessToken JWT Token generated by the login in the frontend or in the Catena-X Keycloak instance.

{
    headers: {
        Authorization: "Bearer <<AccessToken>>"
    }
}

For login and log out!

------
/auth/check #With this api you can check you authentication status.
------
/auth/token #Request token from the keycloak instance
------

API Services

NOTE: You must be authenticated with the keycloak instance to access this APIs

Data

Get data from Catena-X Services

/api/data/catalog?providerUrl=<...> #Get all the catalog from the provider

------
/api/data/submodel/<assetId>?idType=<...>&index=<...>
__________
default idType = "Battery_ID_DMC_Code"
default index = 0

------

/api/data/passport?transferId=<...> #Get passport if the transferId is available -> No contract exchange is required if transferId exists

Passport API

Get a passport from a Catena-X Provider by using its processId, contractId and a token, this retrieves product passport after a successful negotiation.

/api/passport #Get the health status of the server
Request body
{
    "processId": "string",
    "contractId": "string",
    "token": "string"
}

Versions Available

The passport available versions are:

[ "v3.0.1" ] -> Battery Passport

To change the available versions add in the configurations for each environment ``

passport:
    versions:
        - 'v3.0.1'

Contract API

/api/contract/create #Creates a process and checks for the viability of the data retrieval
Request body
{
    "id": "string",
    "type": "string"
}
/api/contract/search #Searches for a passport with the following id
Request body
{
    "processId": "string",
    "id": "string",
    "version": "string",
    "idType": "string",
    "dtIndex": 0,
    "idShort": "string"
}
/api/contract/sign #Sign contract retrieved from provider and start negotiation
Request body
{
    "processId": "string",
    "contractId": "string",
    "token": "string"
}
/api/contract/decline #Decline passport negotiation
Request body
{
    "processId": "string",
    "contractId": "string",
    "token": "string"
}
/api/contract/cancel #Cancel the negotiation
Request body
{
    "processId": "string",
    "contractId": "string",
    "token": "string"
}
/api/contract/status/<processId> #Get status from process

Public APIs

Public APIs don't require authentication

/health #Get the health status of the server
Response
{
    "message": "RUNNING",
    "status": 200,
    "data": "24/11/2022 17:48:18.487"
}
/endpoint/<processId> 
/endpoint/<processId>/<endpointId>

OSS License Check

The third party library dependecies, utilized in this app have to be approved from The Eclipse Foundation.

The Dash Licence Tool is used to scan the dependencies

OSS License Checks with Dash & Compliance with Apache 2.0

At the time of writing this manual, the dependencies have status approved and therefore no need to generate IP Team Review request further.

Maven plugin used to check OSS license

How to run:

mvn org.eclipse.dash:license-tool-plugin:license-check -Ddash.summary=DEPENDENCIES

Swagger Docs

Swagger documentation is now automatically available at the following path:

https://<host>/swagger-ui/index.html

img.png

For authorization, you will need to add a JWT Access token from the Catena-X IAM:

img3.png

Run the application

Use maven to run the spring boot application:

mvn spring-boot:run

If you want to run the application in a different way checkout the frequently asked questions section below.

Modify the configurations in the deployment files

You can use the default configuration to start the application: charts/digital-product-pass/values.yaml

However if you need to change it just create a new environment with this naming convention: values-env`.yaml where env is the name of your environment. You can use as an example the following configuration file: charts/digital-product-pass/values-int.yaml.

The configuration for the consumer backend application is a yaml file that is configured in the following tag: backend.application. Before the application starts all the configuration parameters must be specified, since they are required for initialization and will be checked at the test fase.

Once you configured the application use the follow the TL;DR below to build the image and start the application using helm charts.

TL;DR

Install

Backend Installation

License

Apache-2.0