From 4a78b11c112a2c872827393b1797dc51dd964b27 Mon Sep 17 00:00:00 2001 From: Felix Cornelissen Date: Thu, 31 Oct 2024 10:50:10 +0100 Subject: [PATCH 1/2] chore: api key voor odrc in docker compose --- docker-compose.yml | 4 ++-- docker/odrc/fixtures/api.json | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 docker/odrc/fixtures/api.json diff --git a/docker-compose.yml b/docker-compose.yml index 5d2e0e8..70756d8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: - POSTGRES_PASSWORD=localdev - ASPNETCORE_FORWARDEDHEADERS_ENABLED=true - ODRC_BASE_URL=http://odrc/ - - ODRC_API_KEY=xxx + - ODRC_API_KEY=insecure-ea1a8d297e3b2d3313b8a30b18959c3 - OIDC_ADMIN_ROLE=odpc-admin image: ${DOCKER_REGISTRY-}odpc build: @@ -29,7 +29,7 @@ services: - POSTGRES_PASSWORD=localdev restart: always ports: - - "5432:5432" + - "5432" redis: image: redis:7 command: ["redis-server", "--appendonly", "yes"] diff --git a/docker/odrc/fixtures/api.json b/docker/odrc/fixtures/api.json new file mode 100644 index 0000000..f9c3518 --- /dev/null +++ b/docker/odrc/fixtures/api.json @@ -0,0 +1,15 @@ +[ + { + "model": "api.application", + "pk": 1, + "fields": { + "token": "insecure-ea1a8d297e3b2d3313b8a30b18959c3", + "permissions": "[\"read\", \"write\"]", + "contact_person": "DEMO PURPOSES", + "email": "", + "phone_number": "", + "last_modified": "2024-10-31T09:11:45.207Z", + "created": "2024-10-31T09:11:45.207Z" + } + } + ] \ No newline at end of file From 65addba3ddfebdd82ecf4d7dfa8ab9720f41ad92 Mon Sep 17 00:00:00 2001 From: Felix Cornelissen Date: Mon, 4 Nov 2024 12:15:31 +0100 Subject: [PATCH 2/2] cleanup --- ODPC.Server/Apis/Odrc/OdrcClientFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ODPC.Server/Apis/Odrc/OdrcClientFactory.cs b/ODPC.Server/Apis/Odrc/OdrcClientFactory.cs index 6b68896..d5140a7 100644 --- a/ODPC.Server/Apis/Odrc/OdrcClientFactory.cs +++ b/ODPC.Server/Apis/Odrc/OdrcClientFactory.cs @@ -14,7 +14,7 @@ public HttpClient Create(string? handeling) { var client = httpClientFactory.CreateClient(); client.BaseAddress = new(config["ODRC_BASE_URL"]!); - client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", config["ODRC_API_KEY"]); //dit doet nog niets. nog niet geimplementeerd aan odrc kant. nb nog niet duidelijk of dit de juiste manier zal zijn voor het meesturen van het token + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", config["ODRC_API_KEY"]); client.DefaultRequestHeaders.Add("Audit-User-ID", user.Id); client.DefaultRequestHeaders.Add("Audit-User-Representation", user.FullName); client.DefaultRequestHeaders.Add("Audit-Remarks", handeling);