Skip to content

Commit

Permalink
Støtte lokale lowercase nais-props (#1251)
Browse files Browse the repository at this point in the history
  • Loading branch information
jolarsen authored Feb 22, 2023
1 parent 8a58f43 commit b819340
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package no.nav.vedtak.felles.integrasjon.kafka;

import java.util.Optional;
import java.util.Properties;
import java.util.UUID;

Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit b819340

Please sign in to comment.