From 4a22f2d5a9bc94545c4f38a4f980514ea3e7c794 Mon Sep 17 00:00:00 2001 From: Jens-Otto Larsen Date: Thu, 22 Aug 2024 15:26:27 +0200 Subject: [PATCH] Litt renere --- .../oidc/config/impl/OidcProviderConfig.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 93d1cd689..0a20f0a8c 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 @@ -116,9 +116,9 @@ private static OpenIDConfiguration createStsConfiguration(String wellKnownUrl) { private static OpenIDConfiguration createAzureAppConfiguration(String azureKonfigUrl) { var proxyUrl = (ENV.isFss() && ENV.isProd()) ? ProxyProperty.getProxy() : null; return createConfiguration(OpenIDProvider.AZUREAD, - getPropertyOrWellKnown(AzureProperty.AZURE_OPENID_CONFIG_ISSUER.name(), () -> getIssuerFra(azureKonfigUrl, proxyUrl)), - getPropertyOrWellKnown(AzureProperty.AZURE_OPENID_CONFIG_JWKS_URI.name(), () -> getJwksFra(azureKonfigUrl, proxyUrl)), - getPropertyOrWellKnown(AzureProperty.AZURE_OPENID_CONFIG_TOKEN_ENDPOINT.name(), () -> getTokenEndpointFra(azureKonfigUrl, proxyUrl)), + getPropertyOrWellKnown(getAzureProperty(AzureProperty.AZURE_OPENID_CONFIG_ISSUER), () -> getIssuerFra(azureKonfigUrl, proxyUrl)), + getPropertyOrWellKnown(getAzureProperty(AzureProperty.AZURE_OPENID_CONFIG_JWKS_URI), () -> getJwksFra(azureKonfigUrl, proxyUrl)), + getPropertyOrWellKnown(getAzureProperty(AzureProperty.AZURE_OPENID_CONFIG_TOKEN_ENDPOINT), () -> getTokenEndpointFra(azureKonfigUrl, proxyUrl)), (ENV.isFss() && ENV.isProd()), proxyUrl, getAzureProperty(AzureProperty.AZURE_APP_CLIENT_ID), @@ -128,9 +128,9 @@ private static OpenIDConfiguration createAzureAppConfiguration(String azureKonfi private static OpenIDConfiguration createTokenXConfiguration(String tokenxKonfigUrl) { return createConfiguration(OpenIDProvider.TOKENX, - getPropertyOrWellKnown(TokenXProperty.TOKEN_X_ISSUER.name(), () -> getIssuerFra(tokenxKonfigUrl)), - getPropertyOrWellKnown(TokenXProperty.TOKEN_X_JWKS_URI.name(), () -> getJwksFra(tokenxKonfigUrl)), - getPropertyOrWellKnown(TokenXProperty.TOKEN_X_TOKEN_ENDPOINT.name(), () -> getTokenEndpointFra(tokenxKonfigUrl)), + getPropertyOrWellKnown(getTokenXProperty(TokenXProperty.TOKEN_X_ISSUER), () -> getIssuerFra(tokenxKonfigUrl)), + getPropertyOrWellKnown(getTokenXProperty(TokenXProperty.TOKEN_X_JWKS_URI), () -> getJwksFra(tokenxKonfigUrl)), + getPropertyOrWellKnown(getTokenXProperty(TokenXProperty.TOKEN_X_TOKEN_ENDPOINT), () -> getTokenEndpointFra(tokenxKonfigUrl)), false, null, getTokenXProperty(TokenXProperty.TOKEN_X_CLIENT_ID), @@ -139,8 +139,8 @@ private static OpenIDConfiguration createTokenXConfiguration(String tokenxKonfig false); } - private static String getPropertyOrWellKnown(String propertyname, Supplier> wellknownSupplier) { - return getProperty(propertyname) + private static String getPropertyOrWellKnown(String property, Supplier> wellknownSupplier) { + return Optional.ofNullable(property) .or(wellknownSupplier) .orElse(null); }