Skip to content

Commit

Permalink
Push support for Connectors via server sent events (#691)
Browse files Browse the repository at this point in the history
* feat: add SseServer project

* fix: don't raise domain event in FinalizeSyncRun Handler

* feat: only trigger one DatawalletModifiedDomainEvent, no matter how many modifications were added

* fix: use string for properties in DatawalletModifiedDomainEvent

* chore: move TraceIdMiddleware.cs to BuildingBlocks.API

* chore: formatting

* feat: add JwtSigningCertificate to ConsumerApi appsettings.override.json

* chore: remove RequestResponseTimeMiddleware ResponseDurationMiddleware from ConsumerApi and use the ones from BuildingBlocks isntead

* feat: implement SseServer

* feat: add SseConnector

* chore: throw NotSupportedException instead of NotImplementedException in various places

* chore: cleanup Configuration.cs

* chore: formatting

* feat: make JwtSigningCertificate config required

* refactor: extract method to get push notification name into extension method

* feat: catch exception during send in SseServerClient

* feat: only send event name

* chore: enable SSE for local development

* refactor: extract extension method

* chore: improve folder structure

* fix: don't add success if there is no success

* refactor: add ISseServerClient

* test: add SseConnectorTests.cs

* test: introduce BeEquivalentToJson extension method

* refactor: extract request building logic into SseMessageBuilder

* chore: introduce log event ids

* refactor: rename SseConnector to ServerSentEventsConnector

* chore: move SseServer project to "SseServer/src" folder

* test: add tests for EventQueue

* chore: rename database health checks from "<moduleName>" to "<moduleName>Database"

* feat: add health check to SseServer

* feat: add SseServer health check to Consumer API health check

* feat: add Dockerfile for SseServer

* chore: add SseServer to Backbone.run.xml

* ci: add sse server to build and publish pipelines

* chore: make buildContainerImage.js script executable

* chore: fix formatting

* test: fix test

* feat: add sseserver to helm chart

* ci: add sse server to docker-compose.test.yml

* chore: minor changes

* feat: only enable sse health check if sse is enabled

* ci: add JwtSigningCertificate to pipeline configs

* feat: only create sse resources if sse provider is enabled in config

* test: import FluentAssertions.Json in StringAssertionsExtensions to make the tests work

* test: cleanup

* test: remove unused code

* chore: add local logging overrides for eventhandlerservice

* chore: explicitly AllowAnonymous for "/{address}/events" route

* chore: remove redundant configuration from sseserver's appsettings.json

* feat: make Modules property in SseServer's configuration required

* chore: remove commented out code

* chore: add explaining comments to the call of the UpdateDeviceRegistrationCommand

* ci: fix job name

* fix: remove publishing of TierOfIdentityChangedDomainEvent from Handlers
  • Loading branch information
tnotheis authored Jun 13, 2024
1 parent cf54c5f commit 3b4dfd7
Show file tree
Hide file tree
Showing 101 changed files with 2,033 additions and 412 deletions.
4 changes: 3 additions & 1 deletion .ci/appsettings.override.postgres.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"AccessControlAllowCredentials": true
},
"Authentication": {
"ApiKey": "test"
"ApiKey": "test",
"JwtSigningCertificate": "MIIJ7wIBAzCCCaUGCSqGSIb3DQEHAaCCCZYEggmSMIIJjjCCBAIGCSqGSIb3DQEHBqCCA/MwggPvAgEAMIID6AYJKoZIhvcNAQcBMFcGCSqGSIb3DQEFDTBKMCkGCSqGSIb3DQEFDDAcBAiIVEGIEnzbyAICCAAwDAYIKoZIhvcNAgkFADAdBglghkgBZQMEASoEEC1tOaulJJjkAl2W7xeF3G6AggOAm1VdXzAQ6MhHabp6+rzEuaAyBpuMi8zD8OEl8/xMv47UsFUor38aZjQd14qTTLz5MnksI/qgjQHLuMEmN1eWARsUBkeYvLuz0icl2q9A5Rn9CaKHIemQWq9mIobq3XnXhwDFEd+G/WgjNoK65Ndu20pnuc9LDlfq6fx2eXDbHAWLeUTnlQsEY4M/owNKIjlO/VsYJCshvEPlbtCnyzXwkrtQ5i2XufIJsfX0qoK/dXfoMVUjPxa/L8uR40bAWc1LVkvO0Ox4rY9VCtC1eHe3fcS48AaYCGRMpkZ7N+nDOb7lPs7BcxVoIrj/PkqiNI4rMOZVEgz21OWhueIjBv4gxfV+vW7IZ7xWvC1uUYIKEKEl6mk8KJ5zruO3tObX70+4saBiTNd/76+CVR4qCSwYcD7bZjpMOiaVFyxy0ay3dCwoivLK1jWNFJ25tngYpXKGCtOP0/Zi1fyseo4C54Ef5Yoo+BG3bkKR9VHChWzbB+b1p2lOwfBWIWlGjoZ+expyBjnk+FWrFDZeMknpW3PANCtcT/z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AhWY0CmEe8qfQLeAiV3TsGHSrGSkoegmfPHsuboCdez/ETJZWoodryUPdY3PFNa0xZOJvbtkiG2Vo55Rjq9wbd+MWAGcxhaCVEmEJ0UWWsn3Oe+h4mn3wT9+P+hkAR9duXT6tq+5DmKB2RD3fR3vIc4H5eLaIzOOmjSdfGFvIaj+06jS7SGicuKqF5ND4HPtXJrQgQUdO/gIHCkE9nn4hXCoz/bGkU4FN2WPz5TTMVsYuxMVp1I2UayoQppltkp3oaDb/S36FeO644d5zb7ARayF68NL5MrM/MRK24jhtx2WV4ZN9HIxJTAjBgkqhkiG9w0BCRUxFgQU/S6zDu6S3P4i1WdDz+j3esGxT4UwQTAxMA0GCWCGSAFlAwQCAQUABCCiOwVWGDHil8dA7XvoQNTLTJDm7EwdfGC4KJUV9smgUgQI4ZRrDNXXl8cCAggA",
"JwtLifetimeInSeconds": 300
},
"Infrastructure": {
"EventBus": {
Expand Down
4 changes: 3 additions & 1 deletion .ci/appsettings.override.sqlserver.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"AccessControlAllowCredentials": true
},
"Authentication": {
"ApiKey": "test"
"ApiKey": "test",
"JwtSigningCertificate": "MIIJ7wIBAzCCCaUGCSqGSIb3DQEHAaCCCZYEggmSMIIJjjCCBAIGCSqGSIb3DQEHBqCCA/MwggPvAgEAMIID6AYJKoZIhvcNAQcBMFcGCSqGSIb3DQEFDTBKMCkGCSqGSIb3DQEFDDAcBAiIVEGIEnzbyAICCAAwDAYIKoZIhvcNAgkFADAdBglghkgBZQMEASoEEC1tOaulJJjkAl2W7xeF3G6AggOAm1VdXzAQ6MhHabp6+rzEuaAyBpuMi8zD8OEl8/xMv47UsFUor38aZjQd14qTTLz5MnksI/qgjQHLuMEmN1eWARsUBkeYvLuz0icl2q9A5Rn9CaKHIemQWq9mIobq3XnXhwDFEd+G/WgjNoK65Ndu20pnuc9LDlfq6fx2eXDbHAWLeUTnlQsEY4M/owNKIjlO/VsYJCshvEPlbtCny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weDoitK091ooN6Um74eO17dH0jAQw3XPBxgJ64qEdSzfJ/xybM45BSUPAft2wXXlckLOId9Us56oV7WeszTOkOPDKz9GnKT05xPXNDgAqstVZc0nXEq0eFzTORREBP0w2ijwPu9mfPvRACY8p7YMnNbZzMGBvpa3ILezRIgThMbnzf+YiBP2Ddt9bWoxDsIj7jaqDzxjG2WtI1qGEqFyLCeUkSx2UpkbGViCkx8CsMwXJwLrYdoxqjyOg2Oz09EFF5eI1wkLqEtez8dOTLEn7oFjTyFbRkNoynuwvNqHEG2qzbw02Rb82qyrurKmOnNHog7FXLDe0kGFgKuNXbCw+to2lAhWY0CmEe8qfQLeAiV3TsGHSrGSkoegmfPHsuboCdez/ETJZWoodryUPdY3PFNa0xZOJvbtkiG2Vo55Rjq9wbd+MWAGcxhaCVEmEJ0UWWsn3Oe+h4mn3wT9+P+hkAR9duXT6tq+5DmKB2RD3fR3vIc4H5eLaIzOOmjSdfGFvIaj+06jS7SGicuKqF5ND4HPtXJrQgQUdO/gIHCkE9nn4hXCoz/bGkU4FN2WPz5TTMVsYuxMVp1I2UayoQppltkp3oaDb/S36FeO644d5zb7ARayF68NL5MrM/MRK24jhtx2WV4ZN9HIxJTAjBgkqhkiG9w0BCRUxFgQU/S6zDu6S3P4i1WdDz+j3esGxT4UwQTAxMA0GCWCGSAFlAwQCAQUABCCiOwVWGDHil8dA7XvoQNTLTJDm7EwdfGC4KJUV9smgUgQI4ZRrDNXXl8cCAggA",
"JwtLifetimeInSeconds": 300
},
"Infrastructure": {
"EventBus": {
Expand Down
11 changes: 11 additions & 0 deletions .ci/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ services:
- source: Config
target: app/appsettings.override.json

sse-server:
container_name: sse-server-test
build:
context: ..
dockerfile: SseServer/src/SseServer/Dockerfile
environment:
- ASPNETCORE_ENVIRONMENT=Development
configs:
- source: Config
target: app/appsettings.override.json

database-migrator:
container_name: database-migrator-test
build:
Expand Down
11 changes: 11 additions & 0 deletions .ci/sses/buildContainerImage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env node

import { $ } from "zx";
import { getRequiredEnvVar } from "../lib.js";

const tag = getRequiredEnvVar("TAG");

const platforms = process.env.PLATFORMS ?? "linux/amd64,linux/arm64";
const push = process.env.PUSH === "1" ? ["--push", "--provenance=true", "--sbom=true"] : "";

await $`docker buildx build --file ./SseServer/src/SseServer/Dockerfile --tag ghcr.io/nmshd/backbone-sse-server:${tag} --platform ${platforms} ${push} .`;
33 changes: 32 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ jobs:
PUSH: 1

publish-identity-deletion-jobs:
name: Publish Identity Deletion Jobs Image
name: Publish Identity Deletion Jobs Container Image
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -195,6 +195,37 @@ jobs:
TAG: ${{ github.ref_name }}
PUSH: 1

publish-sse-server:
name: Publish SSE Server Container Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install script dependencies
run: npm install --prefix ./.ci
- name: Docker Login
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub for accessing the cloud builder
uses: docker/login-action@v3
with:
username: ${{ secrets.CLOUD_BUILDER_USERNAME }}
password: ${{ secrets.CLOUD_BUILDER_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: "lab:latest"
driver: cloud
endpoint: "jssoft/js-soft"
- name: Build and Push Container Image
run: ./.ci/sses/buildContainerImage.js
env:
TAG: ${{ github.ref_name }}
PUSH: 1

publish-helm-chart:
name: Publish Helm Chart
runs-on: ubuntu-latest
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ jobs:
PLATFORMS: linux/amd64

build-idj-container-image:
name: Build Database Migrator Container Image
name: Build Identity Deletion Jobs Container Image
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -297,6 +297,22 @@ jobs:
TAG: test
PLATFORMS: linux/amd64

build-sses-container-image:
name: Build SSE Server Container Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install script dependencies
run: npm install --prefix ./.ci
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image
run: ./.ci/sses/buildContainerImage.js
env:
TAG: test
PLATFORMS: linux/amd64

build-fsc-container-image:
name: Build Files Sanity Check Container Image
runs-on: ubuntu-latest
Expand Down
14 changes: 13 additions & 1 deletion .run/Backbone.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,19 @@
</ExecutableSnapshot>
</option>
</ExecutableRowSnapshot>
<ExecutableRowSnapshot>
<option name="condition">
<ConditionSnapshot>
<option name="type" value="immediately"/>
</ConditionSnapshot>
</option>
<option name="executable">
<ExecutableSnapshot>
<option name="id" value="runConfig:.NET Launch Settings Profile.SSE Server"/>
</ExecutableSnapshot>
</option>
</ExecutableRowSnapshot>
</rows>
<method v="2" />
</configuration>
</component>
</component>
17 changes: 17 additions & 0 deletions .run/SSE Server.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="SSE Server" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/SseServer/src/SseServer/SseServer.csproj"/>
<option name="LAUNCH_PROFILE_TFM" value="net8.0"/>
<option name="LAUNCH_PROFILE_NAME" value="Default"/>
<option name="USE_EXTERNAL_CONSOLE" value="0"/>
<option name="USE_MONO" value="0"/>
<option name="RUNTIME_ARGUMENTS" value=""/>
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1"/>
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0"/>
<option name="SEND_DEBUG_REQUEST" value="1"/>
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value=""/>
<method v="2">
<option name="Build"/>
</method>
</configuration>
</component>
2 changes: 0 additions & 2 deletions AdminApi/src/AdminApi/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj

Expand Down
22 changes: 22 additions & 0 deletions Backbone.sln
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DatabaseMigrator", "Databas
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tokens.Domain.Tests", "Modules\Tokens\test\Tokens.Domain.Tests\Tokens.Domain.Tests.csproj", "{EDCB84BE-54C3-4CAD-977E-45EEBEFA1402}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SseServer", "SseServer\src\SseServer\SseServer.csproj", "{434C078E-D738-4C19-AB89-5F56B57EDA7C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SseServer", "SseServer", "{4C2E211B-37C8-4449-9595-7D019AC92AC3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{AAE548AB-4843-476A-BF61-002CF6FEE713}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{824495A9-A255-487D-AF26-6F6CA92BC715}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SseServerTests", "SseServer\test\SseServerTests\SseServerTests.csproj", "{94A32246-991D-483D-8241-E1E4DD6DE145}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -721,6 +731,14 @@ Global
{EDCB84BE-54C3-4CAD-977E-45EEBEFA1402}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EDCB84BE-54C3-4CAD-977E-45EEBEFA1402}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EDCB84BE-54C3-4CAD-977E-45EEBEFA1402}.Release|Any CPU.Build.0 = Release|Any CPU
{434C078E-D738-4C19-AB89-5F56B57EDA7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{434C078E-D738-4C19-AB89-5F56B57EDA7C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{434C078E-D738-4C19-AB89-5F56B57EDA7C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{434C078E-D738-4C19-AB89-5F56B57EDA7C}.Release|Any CPU.Build.0 = Release|Any CPU
{94A32246-991D-483D-8241-E1E4DD6DE145}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94A32246-991D-483D-8241-E1E4DD6DE145}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94A32246-991D-483D-8241-E1E4DD6DE145}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94A32246-991D-483D-8241-E1E4DD6DE145}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -856,6 +874,10 @@ Global
{B4664E79-77A5-41AE-8480-C449ED5B2576} = {D54A9259-7708-45C1-B8D9-448B97F43B80}
{D47E0FE1-23A0-4A96-AF57-E3CE71A132AD} = {2429FCAB-2058-4403-94DA-DA26B1655A7D}
{EDCB84BE-54C3-4CAD-977E-45EEBEFA1402} = {1E437DEA-7657-48AD-ADA0-7B86608E0768}
{AAE548AB-4843-476A-BF61-002CF6FEE713} = {4C2E211B-37C8-4449-9595-7D019AC92AC3}
{434C078E-D738-4C19-AB89-5F56B57EDA7C} = {AAE548AB-4843-476A-BF61-002CF6FEE713}
{824495A9-A255-487D-AF26-6F6CA92BC715} = {4C2E211B-37C8-4449-9595-7D019AC92AC3}
{94A32246-991D-483D-8241-E1E4DD6DE145} = {824495A9-A255-487D-AF26-6F6CA92BC715}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1F3BD2C6-7CB3-450F-A21A-23EA520D5B7A}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ public static void AddSqlDatabaseHealthCheck(this IServiceCollection services, s
case "SqlServer":
services.AddHealthChecks().AddSqlServer(
connectionString,
name: name
name: $"{name}Database"
);
break;
case "Postgres":
services.AddHealthChecks().AddNpgSql(
connectionString: connectionString,
name: name);
name: $"{name}Database"
);
break;
default:
throw new Exception($"Unsupported database provider: {provider}");
Expand Down Expand Up @@ -53,37 +54,37 @@ public static IServiceCollection AddModule<TModule>(this IServiceCollection serv
public static IServiceCollection AddCustomIdentity(this IServiceCollection services, IHostEnvironment environment)
{
services.AddIdentity<ApplicationUser, IdentityRole>(options =>
{
if (environment.IsDevelopment() || environment.IsLocal())
{
options.Password.RequiredLength = 1;
options.Password.RequireUppercase = false;
options.Password.RequireLowercase = false;
options.Password.RequireDigit = false;
options.Password.RequireNonAlphanumeric = false;
if (environment.IsDevelopment() || environment.IsLocal())
{
options.Password.RequiredLength = 1;
options.Password.RequireUppercase = false;
options.Password.RequireLowercase = false;
options.Password.RequireDigit = false;
options.Password.RequireNonAlphanumeric = false;
options.User.AllowedUserNameCharacters += " ";
options.User.AllowedUserNameCharacters += " ";
options.Lockout.AllowedForNewUsers = true;
options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(1);
options.Lockout.MaxFailedAccessAttempts = 3;
}
else
{
options.Password.RequiredLength = 10;
options.Password.RequireUppercase = true;
options.Password.RequireLowercase = true;
options.Password.RequireDigit = true;
options.Password.RequireNonAlphanumeric = true;
options.Lockout.AllowedForNewUsers = true;
options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(1);
options.Lockout.MaxFailedAccessAttempts = 3;
}
else
{
options.Password.RequiredLength = 10;
options.Password.RequireUppercase = true;
options.Password.RequireLowercase = true;
options.Password.RequireDigit = true;
options.Password.RequireNonAlphanumeric = true;
options.Lockout.AllowedForNewUsers = true;
options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(10);
options.Lockout.MaxFailedAccessAttempts = 3;
}
})
.AddEntityFrameworkStores<DevicesDbContext>()
.AddSignInManager<CustomSigninManager>()
.AddUserStore<CustomUserStore>();
options.Lockout.AllowedForNewUsers = true;
options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(10);
options.Lockout.MaxFailedAccessAttempts = 3;
}
})
.AddEntityFrameworkStores<DevicesDbContext>()
.AddSignInManager<CustomSigninManager>()
.AddUserStore<CustomUserStore>();

services.AddScoped<ILookupNormalizer, CustomLookupNormalizer>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Backbone.ConsumerApi.Mvc.Middleware;
using Microsoft.AspNetCore.Http;

namespace Backbone.BuildingBlocks.API.Mvc.Middleware;

public class TraceIdMiddleware
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
namespace Backbone.BuildingBlocks.Application.PushNotifications;

public interface IPushNotification;

public static class IPushNotificationExtensions
{
private const string PUSH_NOTIFICATION_POSTFIX = "PushNotification";

public static string GetEventName(this IPushNotification pushNotification)
{
var notificationTypeName = pushNotification.GetType().Name;

if (notificationTypeName.Contains(PUSH_NOTIFICATION_POSTFIX))
return notificationTypeName.Replace(PUSH_NOTIFICATION_POSTFIX, "");

return "dynamic";
}
}
Loading

0 comments on commit 3b4dfd7

Please sign in to comment.