From 654aaae2b7cf3d343e3578d3eb2964027adcb3bc Mon Sep 17 00:00:00 2001 From: Miguel Prieto Date: Tue, 29 Oct 2024 21:44:03 -0300 Subject: [PATCH] Allow no credentials with ApiClient --- ...OrkesConductorClientAutoConfiguration.java | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/conductor-clients/java/conductor-java-sdk/orkes-spring/src/main/java/io/orkes/conductor/client/spring/OrkesConductorClientAutoConfiguration.java b/conductor-clients/java/conductor-java-sdk/orkes-spring/src/main/java/io/orkes/conductor/client/spring/OrkesConductorClientAutoConfiguration.java index f8b758030..9eb138fc8 100644 --- a/conductor-clients/java/conductor-java-sdk/orkes-spring/src/main/java/io/orkes/conductor/client/spring/OrkesConductorClientAutoConfiguration.java +++ b/conductor-clients/java/conductor-java-sdk/orkes-spring/src/main/java/io/orkes/conductor/client/spring/OrkesConductorClientAutoConfiguration.java @@ -55,24 +55,21 @@ public ApiClient orkesConductorClient(ClientProperties clientProperties, return null; } - String key = null; - String secret = null; - if (orkesClientProperties.getKeyId() != null) { - key = orkesClientProperties.getKeyId(); - secret = orkesClientProperties.getSecret(); - } else if (orkesClientProperties.getSecurityKeyId() != null) { - key = orkesClientProperties.getSecurityKeyId(); - secret = orkesClientProperties.getSecuritySecret(); - } - - return ApiClient.builder() + var builder = ApiClient.builder() .basePath(basePath) - .credentials(key, secret) .connectTimeout(clientProperties.getTimeout().getConnect()) .readTimeout(clientProperties.getTimeout().getRead()) .writeTimeout(clientProperties.getTimeout().getWrite()) - .verifyingSsl(clientProperties.isVerifyingSsl()) - .build(); + .verifyingSsl(clientProperties.isVerifyingSsl()); + + + if (orkesClientProperties.getKeyId() != null) { + builder.credentials(orkesClientProperties.getKeyId(), orkesClientProperties.getSecret()); + } else if (orkesClientProperties.getSecurityKeyId() != null) { + builder.credentials(orkesClientProperties.getSecurityKeyId(), orkesClientProperties.getSecuritySecret()); + } + + return builder.build(); } @Bean