From d3879e26338be0b3a991c7099745a70e39c56b11 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 29 Jul 2024 16:00:45 +0200 Subject: [PATCH] 1433: add project config for koblenz, fix import, adjust hash in the docs --- .../ehrenamtskarte/backend/cards/Argon2IdHasher.kt | 6 +++--- backend/src/main/resources/config/config.yml | 11 +++++++++++ .../ehrenamtskarte/backend/cards/CanonicalJsonTest.kt | 2 +- docs/CreateKoblenzHash.md | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/backend/src/main/kotlin/app/ehrenamtskarte/backend/cards/Argon2IdHasher.kt b/backend/src/main/kotlin/app/ehrenamtskarte/backend/cards/Argon2IdHasher.kt index c19979576..373063f07 100644 --- a/backend/src/main/kotlin/app/ehrenamtskarte/backend/cards/Argon2IdHasher.kt +++ b/backend/src/main/kotlin/app/ehrenamtskarte/backend/cards/Argon2IdHasher.kt @@ -1,8 +1,8 @@ +import app.ehrenamtskarte.backend.cards.CanonicalJson import app.ehrenamtskarte.backend.common.utils.Environment import app.ehrenamtskarte.backend.common.webservice.KOBLENZ_PEPPER_SYS_ENV import app.ehrenamtskarte.backend.user.KoblenzUser -import app.ehrenamtskarte.backend.verification.CanonicalJson import org.bouncycastle.crypto.generators.Argon2BytesGenerator import org.bouncycastle.crypto.params.Argon2Parameters import java.nio.charset.StandardCharsets @@ -51,8 +51,8 @@ class Argon2IdHasher { val canonicalJson = CanonicalJson.koblenzUserToString(userData) val hashLength = 32 - val pepper = Environment.getVariable(KOBLENZ_PEPPER_SYS_ENV) // TODO handle if Null - val pepperByteArray = pepper?.toByteArray(StandardCharsets.UTF_8) + val pepper = Environment.getVariable(KOBLENZ_PEPPER_SYS_ENV) ?: throw Exception("No koblenz pepper found") + val pepperByteArray = pepper.toByteArray(StandardCharsets.UTF_8) val params = Argon2Parameters .Builder(Argon2Parameters.ARGON2_id) diff --git a/backend/src/main/resources/config/config.yml b/backend/src/main/resources/config/config.yml index cde974f35..45b864b56 100644 --- a/backend/src/main/resources/config/config.yml +++ b/backend/src/main/resources/config/config.yml @@ -38,6 +38,17 @@ projects: port: 587 username: OVERRIDE_IN_LOCAL_CONFIG password: OVERRIDE_IN_LOCAL_CONFIG + - id: koblenz.sozialpass.app + importUrl: "" + pipelineName: SozialpassKoblenz + administrationBaseUrl: https://koblenz.sozialpass.app + administrationName: Koblenz-Pass-Verwaltung + timezone: "Europe/Berlin" + smtp: + host: mail.sozialpass.app + port: 587 + username: OVERRIDE_IN_LOCAL_CONFIG + password: OVERRIDE_IN_LOCAL_CONFIG - id: showcase.entitlementcard.app importUrl: https://example.com pipelineName: BerechtigungskarteShowcase diff --git a/backend/src/test/kotlin/app/ehrenamtskarte/backend/cards/CanonicalJsonTest.kt b/backend/src/test/kotlin/app/ehrenamtskarte/backend/cards/CanonicalJsonTest.kt index 463becbd1..4a13257e9 100644 --- a/backend/src/test/kotlin/app/ehrenamtskarte/backend/cards/CanonicalJsonTest.kt +++ b/backend/src/test/kotlin/app/ehrenamtskarte/backend/cards/CanonicalJsonTest.kt @@ -1,10 +1,10 @@ package app.ehrenamtskarte.backend.cards import Card +import app.ehrenamtskarte.backend.cards.CanonicalJson.Companion.koblenzUserToString import app.ehrenamtskarte.backend.helper.CardInfoTestSample import app.ehrenamtskarte.backend.helper.ExampleCardInfo import app.ehrenamtskarte.backend.helper.koblenzTestUser -import app.ehrenamtskarte.backend.verification.CanonicalJson.Companion.koblenzUserToString import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFailsWith diff --git a/docs/CreateKoblenzHash.md b/docs/CreateKoblenzHash.md index 482152048..52f679b6c 100644 --- a/docs/CreateKoblenzHash.md +++ b/docs/CreateKoblenzHash.md @@ -51,7 +51,7 @@ Hash with Argon2id with the following parameters: ### 4. The result... ...for the example data and example salt must be (output in encoded form with salt removed): -`$argon2id$v=19$m=16,t=2,p=1$UIOJZIsSL8vXcuCB82xZ5E8tpH6sQd3d4U0uC02DP40` +`$argon2id$v=19$m=19,t=2,p=1$78SNlzz8llqPwetRlp8Lnag/WZGPc5XbimYbShpwVMQ` ## Additional Information