From b819340f1cf02f25d110c489dacfac48e1ce7eeb Mon Sep 17 00:00:00 2001 From: Jens-Otto Larsen <46576810+jolarsen@users.noreply.github.com> Date: Wed, 22 Feb 2023 14:08:51 +0100 Subject: [PATCH] =?UTF-8?q?St=C3=B8tte=20lokale=20lowercase=20nais-props?= =?UTF-8?q?=20(#1251)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../no/nav/vedtak/sikkerhet/oidc/config/AzureProperty.java | 6 ------ .../sikkerhet/oidc/config/impl/OidcProviderConfig.java | 6 ++++-- .../vedtak/sikkerhet/tokenx/TokenXAssertionGenerator.java | 4 +++- .../vedtak/felles/integrasjon/kafka/KafkaProperties.java | 4 +++- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/felles/oidc/src/main/java/no/nav/vedtak/sikkerhet/oidc/config/AzureProperty.java b/felles/oidc/src/main/java/no/nav/vedtak/sikkerhet/oidc/config/AzureProperty.java index f1934af48..ee2ee7fa8 100644 --- a/felles/oidc/src/main/java/no/nav/vedtak/sikkerhet/oidc/config/AzureProperty.java +++ b/felles/oidc/src/main/java/no/nav/vedtak/sikkerhet/oidc/config/AzureProperty.java @@ -15,12 +15,6 @@ public enum AzureProperty { AZURE_OPENID_CONFIG_JWKS_URI, AZURE_OPENID_CONFIG_TOKEN_ENDPOINT ; - // public static final String AZURE_WELL_KNOWN_URL = "azure.app.well.known.url"; // naiserator - // public static final String AZURE_CONFIG_ISSUER = "azure.openid.config.issuer"; // naiserator - // public static final String AZURE_CONFIG_JWKS_URI = "azure.openid.config.jwks.uri"; // naiserator - // private static final String AZURE_CONFIG_TOKEN_ENDPOINT = "azure.openid.config.token.endpoint"; // naiserator - // public static final String AZURE_CLIENT_ID = "azure.app.client.id"; // naiserator - // private static final String AZURE_CLIENT_SECRET = "azure.app.client.secret"; // naiserator public static final String NAV_IDENT = "NAVident"; public static final String AZP_NAME = "azp_name"; diff --git a/felles/oidc/src/main/java/no/nav/vedtak/sikkerhet/oidc/config/impl/OidcProviderConfig.java b/felles/oidc/src/main/java/no/nav/vedtak/sikkerhet/oidc/config/impl/OidcProviderConfig.java index 6cbf1d65e..2f0bb18c6 100644 --- a/felles/oidc/src/main/java/no/nav/vedtak/sikkerhet/oidc/config/impl/OidcProviderConfig.java +++ b/felles/oidc/src/main/java/no/nav/vedtak/sikkerhet/oidc/config/impl/OidcProviderConfig.java @@ -162,11 +162,13 @@ private static OpenIDConfiguration createAzureAppConfiguration(String wellKnownU } private static String getAzureProperty(AzureProperty property) { - return ENV.getProperty(property.name()); + return Optional.ofNullable(ENV.getProperty(property.name())) + .orElseGet(() -> ENV.getProperty(property.name().toLowerCase().replace('_', '.'))); } private static String getTokenXProperty(TokenXProperty property) { - return ENV.getProperty(property.name()); + return Optional.ofNullable(ENV.getProperty(property.name())) + .orElseGet(() -> ENV.getProperty(property.name().toLowerCase().replace('_', '.'))); } private static OpenIDConfiguration createTokenXConfiguration(String wellKnownUrl) { diff --git a/felles/oidc/src/main/java/no/nav/vedtak/sikkerhet/tokenx/TokenXAssertionGenerator.java b/felles/oidc/src/main/java/no/nav/vedtak/sikkerhet/tokenx/TokenXAssertionGenerator.java index bd8d98f8a..d7a79cdef 100644 --- a/felles/oidc/src/main/java/no/nav/vedtak/sikkerhet/tokenx/TokenXAssertionGenerator.java +++ b/felles/oidc/src/main/java/no/nav/vedtak/sikkerhet/tokenx/TokenXAssertionGenerator.java @@ -28,7 +28,9 @@ final class TokenXAssertionGenerator { private TokenXAssertionGenerator() { this(ConfigProvider.getOpenIDConfiguration(OpenIDProvider.TOKENX).map(OpenIDConfiguration::tokenEndpoint).orElse(null), ConfigProvider.getOpenIDConfiguration(OpenIDProvider.TOKENX).map(OpenIDConfiguration::clientId).orElse(null), - Optional.ofNullable(Environment.current().getProperty(TokenXProperty.TOKEN_X_PRIVATE_JWK.name())).map(TokenXAssertionGenerator::rsaKey).orElse(null)); + Optional.ofNullable(Environment.current().getProperty(TokenXProperty.TOKEN_X_PRIVATE_JWK.name())) + .or(() -> Optional.ofNullable(Environment.current().getProperty(TokenXProperty.TOKEN_X_PRIVATE_JWK.name().toLowerCase().replace('_', '.')))) + .map(TokenXAssertionGenerator::rsaKey).orElse(null)); } // Kun til TestformÄl diff --git a/integrasjon/kafka-properties/src/main/java/no/nav/vedtak/felles/integrasjon/kafka/KafkaProperties.java b/integrasjon/kafka-properties/src/main/java/no/nav/vedtak/felles/integrasjon/kafka/KafkaProperties.java index deeeb67e9..0213c3133 100644 --- a/integrasjon/kafka-properties/src/main/java/no/nav/vedtak/felles/integrasjon/kafka/KafkaProperties.java +++ b/integrasjon/kafka-properties/src/main/java/no/nav/vedtak/felles/integrasjon/kafka/KafkaProperties.java @@ -1,5 +1,6 @@ package no.nav.vedtak.felles.integrasjon.kafka; +import java.util.Optional; import java.util.Properties; import java.util.UUID; @@ -83,7 +84,8 @@ public static String getAvroSchemaRegistryBasicAuth() { private static String getAivenConfig(AivenProperty property) { - return ENV.getProperty(property.name()); + return Optional.ofNullable(ENV.getProperty(property.name())) + .orElseGet(() -> ENV.getProperty(property.name().toLowerCase().replace('_', '.'))); } private static String generateClientId() {