Skip to content
Snippets Groups Projects
README.md 5.12 KiB
Newer Older
<br />
<div align="center"><img src="https://www.fitko.de/fileadmin/_processed_/b/9/csm_FIT-Connect_3e8e926015.jpg" alt="Logo" width="50%" height="50%"> </div>
Martin Vogel's avatar
Martin Vogel committed

The Java SDK for FIT-Connect enables to build clients for senders and subscribers without directly interacting with any REST-Endpoints.
It provides a simple fluent API that guides through the creation and sending of a submission, as well as receiving submissions as a subscriber.
For further information, check out the official docs: [FIT-Connect Documentation](https://docs.fitko.de/fit-connect/docs/) as well as the:
Martin Vogel's avatar
Martin Vogel committed

* [Self-Service-Portal (Testing Environment)](https://portal.auth-testing.fit-connect.fitko.dev/)
* [FITKO project website](https://www.fitko.de/projektmanagement/fit-connect)
This section lists major frameworks/libraries used in the SDK.
Martin Vogel's avatar
Martin Vogel committed

* Java 11 (LTS)
* Maven 3.x
* Junit 5

Further 3rd party dependencies:

* Nimbus-Jose JWT
* Spring Web/HTTP
* Jackson FasterXMl
* JCommander

## Getting Started

How to set up the SDK project locally.

### Prerequisites

* Java Runtime >= 11, check your current setup in your commandline
  ```sh
  java --version 
  ```

<p align="right">(<a href="#top">back to top</a>)</p>

### Modules

See the projects' module documentation for more specific information:

* [API Module ](api/README.md)
* [Core Module ](core/README.md)
* [Client Module ](client/README.md)

### Setup

_The following steps show how to get the SDK running_

1. Create and [account](https://docs.fitko.de/fit-connect/docs/getting-started/account) on the self service portal
2. Get your sender/subscriber API-key credentials
3. Clone the sdk repo
   ```sh
   git clone https://git.fitko.de/fit-connect/sdk-java
   ```
4. Build the project
   ```sh
Martin Vogel's avatar
Martin Vogel committed
   ./mvnw clean install -DskipTests
5. Enter your API keys and references to your private decryption key in `config.yml`
6. Provide config via environment variable ``FIT_CONNECT_CONFIG`` or load the config with 
    ````java
      var config = ApplicationConfigLoader.loadConfig("absolute/path/to/config.yml");
      var senderClient = ClientFactory.senderClient(config);
      ````
<p align="right">(<a href="#top">back to top</a>)</p>

## Usage

### Hand in new submission
ClientFactory.senderClient(config)
        .newSubmission()
        .withAttachment(Path.of("path/to/attachment.txt").toFile()) // optional
        .withJsonData("{ foo: 'bar'}")
        .withDestination(UUID.fromString("destinationId"))
        .withServiceType("TestService", "Führerscheinbeantragung",  "urn:de:fim:leika:leistung:99400048079000")
        .submit();
```
### Hand in already encrypted submission (e.g. from frontend)

```java
ClientFactory.senderClient(config)
        .newSubmissionWithEncryptedData("$encrpyt€ed d@t@")
        .withEncryptedAttachment(UUID.fromString("attachmentId"), "$encrpyt€ed @tt@chment")
        .withEncryptedJsonData("{$encrpyt€ed json}")
        .withEncryptedMetadata("$encrpyt€ed metadata")
        .withDestination(UUID.fromString("destinationId"))
        .withServiceType("TestService", "Führerscheinbeantragung",  "urn:de:fim:leika:leistung:99400048079000")
### Retrieve public encryption key
Optional<String> jweKey =  ClientFactory.subscriberClient(config).getPublicKey(UUID.fromString("destinationId"));
```
### List all submissions for a destination
```java
Set<SubmissionForPickup> submissions =  ClientFactory.subscriberClient(config).getAvailableSubmissions(UUID.fromString("destinationId"));
```
### Receive single submission

```java
Optional<ReceivedSubmission> submission =  ClientFactory.subscriberClient(config).requestSubmission(UUID.fromString("destinationId"));
```

<p align="right">(<a href="#top">back to top</a>)</p>


## Roadmap

- [ ] Add Routing features
- [ ] Add Callback handling

See the [open issues](https://git.fitko.de/fit-connect/planning/-/boards/44?search=SDK) for a full list of proposed features (and known issues).

<p align="right">(<a href="#top">back to top</a>)</p>
[FIT-Connect Contact Page](https://docs.fitko.de/fit-connect/contact/) for further information

<p align="right">(<a href="#top">back to top</a>)</p>

## License
Source code is licensed under the EUPL.

*Rechtlicher Hinweis: Dieses Software Development Kit (SDK) ist dazu bestimmt, die Anbindung einer Software an die FIT-Connect-Infrastruktur zu ermöglichen. 
Hierfür kann das SDK in die anzubindenden Software integriert werden. 
Erfolgt die Integration des SDK in unveränderter Form, liegt keine Bearbeitung im Sinne der EUPL bzw. des deutschen Urheberrechts vor. 
Die Art und Weise der Verlinkung des SDK führt insbesondere nicht zur Schaffung eines abgeleiteten Werkes. 
Die unveränderte Übernahme des SDK in eine anzubindende Software führt damit nicht dazu, dass die anzubindende Software unter den Bedingungen der EUPL zu lizenzieren ist. 
Für die Weitergabe des SDK selbst - in unveränderter oder bearbeiteter Form, als Quellcode oder ausführbares Programm - gelten die Lizenzbedingungen der EUPL in unverände*rter Weise.
<p align="right">(<a href="#top">back to top</a>)</p>