From d9304e4051fcf41225c9c258f77b5f5911d96465 Mon Sep 17 00:00:00 2001 From: Klaus Fischer <klaus.fischer@eloware.com> Date: Mon, 4 Jul 2022 10:31:21 +0200 Subject: [PATCH] Added Dockerfile to run encryption tests --- Dockerfile | 12 ++++++ readme.md | 110 ++---------------------------------------------- structure.md | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 133 insertions(+), 106 deletions(-) create mode 100644 Dockerfile create mode 100644 structure.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..0e4d7c56 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /test + +COPY . . +RUN dotnet test EncryptionTests/EncryptionTests.csproj + +RUN dotnet build DummyClient/DummyClient.csproj -c Release -o /test/build + +FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base +COPY --from=build /test/build . + +CMD ["dotnet", "DummyClient.dll"] \ No newline at end of file diff --git a/readme.md b/readme.md index ab8a5455..e72d0982 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,9 @@ # Fit-Connect .NET SDK +## Structure + +For the structure look the [Structure documentation](structure.md) + ## **!! IN DEVELOPMENT NOT FOR PRODUCTION USE !!** **Fit-Connect .NET SDK** is a .NET library for the Fit-Connect API. @@ -9,112 +13,6 @@ * [SDK-Documentation](./documentation/documentation.md) * [FitConnect Documentation](https://fit-connect.com/docs) -## Structure - -```mermaid - classDiagram - class FitConnectClient{ - FitConnectApiService - } - - class FitConnectApiService{ - CasesService - DestinationService - InfoService - OAuthService - RouteService - } - - FitConnectClient ..> SubmissionSender : public - FitConnectClient ..> SubmissionSubscriber : public - SubmissionSender --|> FunctionalBaseClass - SubmissionSubscriber --|> FunctionalBaseClass - FunctionalBaseClass ..> FitConnectApiService : protected - - FitConnectApiService ..> RouteService : public - FitConnectApiService ..> CasesService : public - FitConnectApiService ..> DestinationService : public - FitConnectApiService ..> InfoService : public - FitConnectApiService ..> OAuthService : public - - RouteService --|> RestCallService : Inheritance - CasesService --|> RestCallService : Inheritance - DestinationService --|> RestCallService : Inheritance - InfoService --|> RestCallService : Inheritance - OAuthService --|> RestCallService : Inheritance - -``` - -With that structure the user of the SDK is intended to see the following: (For easier reading all -methods are shown sync) - -```mermaid - classDiagram - class FitConnectClient { - << Draft >> - - Sender - - Subscriber - + SendSumission(submission) - + GetSubmissions(offset, limit) - + GetSubmission(id) - } - - class Sender { - << Draft >> - + bool CheckPublicKey(string publicKey) - + bool CheckPublicKey(byte[] publicKey) - + string EncryptData(string? data) - + string EncryptAttachment(byte[] attachment) - + string CreateMetadata(string data, byte[] attachment) ??? - - * Pruefung von oeffentlichen Schluesseln und Zertifikatsketten + OCSP-Check - * Verschluesselung von Fachdaten [JSON, XML] mittels JWE - * Verschluesselung von Anhängen [Binaerdaten] mittels JWE - * Korrekte Erzeugung eines Metadatensatzes inkl. Hashwerte - } - - class Subscriber { - << Draft >> - + byte[] DecryptAttachment(string attachment) - + SecurityEventToken CreateSecurityEventToken(string data, string attachment, string privateKey) - + bool CheckMetadata(string metaData) - + string DecryptData(string data) - + bool CheckHash(string metaData, string hash) - - * Entschluesselung von Fachdaten [JSON oder XML] mittels JWE - * Entschluesselung von Anhaengen [Binaerdaten] mittels JWE - * Pruefung der empfangenen Metadaten gegen das zugehörige JSON-Schema - * Pruefung der Hashwerte aus dem Metadatensatz. - * SET-Erstellung inkl. Signaturerzeugung - - } - - class FunctionalBaseClass{ - + GetOAuthTokenAsync(string clientId, string clientSecret, string? scope) - + SecurityEventToken GetSetData() - * SET-Empfang inkl. Signaturpruefung - * Unterstuezung / Abstraktion der API-Nutzung - * Abruf des OAuth-Tokens - } - - FitConnectClient <--> Sender - FitConnectClient <--> Subscriber - - Sender --|> FunctionalBaseClass - Subscriber --|> FunctionalBaseClass -``` - -### Annotation - -The structure ensures a abstraction of the API calls for the user and a 'simple' way to change the -API calls if a new version of the API is released. Currently the API call is not versioned and hard -coded. - -#### Abstractions for API calls - -- The use of a dependency injection can be added to - inject the API calls into the SDK. But is not yet implemented. -- Another approach would be using a generic class for the API calls. ## Ignored Files diff --git a/structure.md b/structure.md new file mode 100644 index 00000000..8099ea59 --- /dev/null +++ b/structure.md @@ -0,0 +1,117 @@ +# Structure + +## Functional Diagram + +```mermaid + classDiagram + class FitConnectClient{ + FitConnectApiService + } + + class FitConnectApiService{ + CasesService + DestinationService + InfoService + OAuthService + RouteService + } + + FitConnectClient ..> SubmissionSender : public + FitConnectClient ..> SubmissionSubscriber : public + SubmissionSender --|> FunctionalBaseClass + SubmissionSubscriber --|> FunctionalBaseClass + FunctionalBaseClass ..> FitConnectApiService : protected + + FitConnectApiService ..> RouteService : public + FitConnectApiService ..> CasesService : public + FitConnectApiService ..> DestinationService : public + FitConnectApiService ..> InfoService : public + FitConnectApiService ..> OAuthService : public + + RouteService --|> RestCallService : Inheritance + CasesService --|> RestCallService : Inheritance + DestinationService --|> RestCallService : Inheritance + InfoService --|> RestCallService : Inheritance + OAuthService --|> RestCallService : Inheritance + +``` + +With that structure the user of the SDK is intended to see the following: (For easier reading all +methods are shown sync) + +```mermaid + classDiagram + class FitConnectClient { + << Draft >> + - Sender + - Subscriber + + SendSumission(submission) + + GetSubmissions(offset, limit) + + GetSubmission(id) + } + + class Sender { + << Draft >> + + bool CheckPublicKey(string publicKey) + + bool CheckPublicKey(byte[] publicKey) + + string EncryptData(string? data) + + string EncryptAttachment(byte[] attachment) + + string CreateMetadata(string data, byte[] attachment) ??? + + * Pruefung von oeffentlichen Schluesseln und Zertifikatsketten + OCSP-Check + * Verschluesselung von Fachdaten [JSON, XML] mittels JWE + * Verschluesselung von Anhängen [Binaerdaten] mittels JWE + * Korrekte Erzeugung eines Metadatensatzes inkl. Hashwerte + } + + class Subscriber { + << Draft >> + + byte[] DecryptAttachment(string attachment) + + SecurityEventToken CreateSecurityEventToken(string data, string attachment, string privateKey) + + bool CheckMetadata(string metaData) + + string DecryptData(string data) + + bool CheckHash(string metaData, string hash) + + * Entschluesselung von Fachdaten [JSON oder XML] mittels JWE + * Entschluesselung von Anhaengen [Binaerdaten] mittels JWE + * Pruefung der empfangenen Metadaten gegen das zugehörige JSON-Schema + * Pruefung der Hashwerte aus dem Metadatensatz. + * SET-Erstellung inkl. Signaturerzeugung + + } + + class FunctionalBaseClass{ + + GetOAuthTokenAsync(string clientId, string clientSecret, string? scope) + + SecurityEventToken GetSetData() + * SET-Empfang inkl. Signaturpruefung + * Unterstuezung / Abstraktion der API-Nutzung + * Abruf des OAuth-Tokens + } + + FitConnectClient <--> Sender + FitConnectClient <--> Subscriber + + Sender --|> FunctionalBaseClass + Subscriber --|> FunctionalBaseClass +``` + +## Class diagram + +```mermaid + classDiagram + class Client{ + } +``` + + +## Annotation + +The structure ensures a abstraction of the API calls for the user and a 'simple' way to change the +API calls if a new version of the API is released. Currently the API call is not versioned and hard +coded. + +### Abstractions for API calls + +- The use of a dependency injection can be added to + inject the API calls into the SDK. But is not yet implemented. +- Another approach would be using a generic class for the API calls. -- GitLab