From 3833049c4c5cfba58b48efe706b8c90f1b9619c8 Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Balan <113347266+alexandru-ionut-balan@users.noreply.github.com> Date: Wed, 4 Oct 2023 16:12:48 +0300 Subject: [PATCH] Fix Showcase API Client (#54) * Revert "fix: Add missing state parameter to authorization url" This reverts commit 29e6a90f3eca66a56e712786834c61f70056fe20. * Revert "Revert "fix: Add missing state parameter to authorization url"" This reverts commit d3f05b295dc8aa94671df7a0f0657a5d20e3a54b. * fix: Fix showcase API client not working after swagger update --- .../app/apis/greetings/GreetingsAdapter.java | 11 +++-------- .../app/configuration/GreetingsConfiguration.java | 6 +++--- .../com/ing/developer/app/PremiumShowcaseAPI.java | 8 ++++---- .../com/ing/developer/app/ProductionShowcaseAPI.java | 4 ++-- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/java/open-banking-demo-app/src/main/java/com/ing/developer/app/apis/greetings/GreetingsAdapter.java b/java/open-banking-demo-app/src/main/java/com/ing/developer/app/apis/greetings/GreetingsAdapter.java index e8496c8..002102a 100644 --- a/java/open-banking-demo-app/src/main/java/com/ing/developer/app/apis/greetings/GreetingsAdapter.java +++ b/java/open-banking-demo-app/src/main/java/com/ing/developer/app/apis/greetings/GreetingsAdapter.java @@ -1,22 +1,17 @@ package com.ing.developer.app.apis.greetings; -import com.ing.developer.common.Utils; -import com.ing.developer.common.clients.Companion; import com.ing.developer.showcase.client.ApiException; -import com.ing.developer.showcase.client.api.GreetingsApi; +import com.ing.developer.showcase.client.api.ShowcaseApiApi; import org.springframework.stereotype.Component; -import java.security.PrivateKey; -import java.security.cert.Certificate; - import static com.ing.developer.app.common.GenericAdapterErrorHandler.throwInternalizedException; @Component public class GreetingsAdapter { - private final GreetingsApi greetingsApi; + private final ShowcaseApiApi greetingsApi; - public GreetingsAdapter(GreetingsApi greetingsApi) { + public GreetingsAdapter(ShowcaseApiApi greetingsApi) { this.greetingsApi = greetingsApi; } diff --git a/java/open-banking-demo-app/src/main/java/com/ing/developer/app/configuration/GreetingsConfiguration.java b/java/open-banking-demo-app/src/main/java/com/ing/developer/app/configuration/GreetingsConfiguration.java index 00d4d9d..11ad6c4 100644 --- a/java/open-banking-demo-app/src/main/java/com/ing/developer/app/configuration/GreetingsConfiguration.java +++ b/java/open-banking-demo-app/src/main/java/com/ing/developer/app/configuration/GreetingsConfiguration.java @@ -3,7 +3,7 @@ import com.ing.developer.common.Utils; import com.ing.developer.common.clients.Companion; import com.ing.developer.showcase.client.ApiClient; -import com.ing.developer.showcase.client.api.GreetingsApi; +import com.ing.developer.showcase.client.api.ShowcaseApiApi; import org.springframework.context.annotation.Bean; import org.springframework.core.env.Environment; @@ -33,8 +33,8 @@ public GreetingsConfiguration(Environment env) { } @Bean - public GreetingsApi greetingsApi() { - return new GreetingsApi(buildClient()); + public ShowcaseApiApi greetingsApi() { + return new ShowcaseApiApi(buildClient()); } private ApiClient buildClient() { diff --git a/java/open-banking-simple-app/src/main/java/com/ing/developer/app/PremiumShowcaseAPI.java b/java/open-banking-simple-app/src/main/java/com/ing/developer/app/PremiumShowcaseAPI.java index 393b6c7..3c50a69 100644 --- a/java/open-banking-simple-app/src/main/java/com/ing/developer/app/PremiumShowcaseAPI.java +++ b/java/open-banking-simple-app/src/main/java/com/ing/developer/app/PremiumShowcaseAPI.java @@ -3,7 +3,7 @@ import com.ing.developer.common.clients.Companion; import com.ing.developer.showcase.client.ApiClient; import com.ing.developer.showcase.client.ApiException; -import com.ing.developer.showcase.client.api.GreetingsApi; +import com.ing.developer.showcase.client.api.ShowcaseApiApi; import javax.ws.rs.client.ClientBuilder; @@ -23,7 +23,7 @@ public class PremiumShowcaseAPI { public static void callShowcaseAPI() throws ApiException { Utils.Pair trustMaterial = Companion.Utils.createOpenBankingClient(keyStoreFileName, keyStorePassword, false, null, null, false, false); ApiClient clientAPI = new ApiClient(clientId, trustMaterial.getFirst(), trustMaterial.getSecond()); - GreetingsApi greetingsApi = new GreetingsApi(clientAPI); + ShowcaseApiApi greetingsApi = new ShowcaseApiApi(clientAPI); String greeting = greetingsApi.greetingsSingleGet(null).getMessage(); System.out.println(greeting); } @@ -31,7 +31,7 @@ public static void callShowcaseAPI() throws ApiException { public static void callShowcaseAPIMTLSPinning() throws ApiException { Utils.Pair trustMaterial = Companion.Utils.createOpenBankingClient(keyStoreFileName, keyStorePassword, false, null, null, false, false); ApiClient clientAPI = new ApiClient(clientId, trustMaterial.getFirst(), trustMaterial.getSecond()).setMTLSPinning(true); - GreetingsApi greetingsApi = new GreetingsApi(clientAPI); + ShowcaseApiApi greetingsApi = new ShowcaseApiApi(clientAPI); String greeting = greetingsApi.mtlsOnlyGreetingsGet(null).getMessage(); System.out.println(greeting); } @@ -40,7 +40,7 @@ public static void callShowcaseAPIJWS() throws ApiException { Utils.Pair trustMaterial = Companion.Utils.getTrustMaterial(keyStoreFileName, keyStorePassword); Utils.Pair openBankingClient = Companion.Utils.createOpenBankingClient(keyStoreFileName, keyStorePassword, false, null, null, false, false); ApiClient clientAPI = new ApiClient(clientId, trustMaterial.getSecond(), openBankingClient.getSecond(), null, trustMaterial.getFirst()).setMTLSPinning(true).setJwsSigning(true); - GreetingsApi greetingsApi = new GreetingsApi(clientAPI); + ShowcaseApiApi greetingsApi = new ShowcaseApiApi(clientAPI); String greeting = greetingsApi.signedGreetingsGet(null,null).getMessage(); System.out.println(greeting); } diff --git a/java/open-banking-simple-app/src/main/java/com/ing/developer/app/ProductionShowcaseAPI.java b/java/open-banking-simple-app/src/main/java/com/ing/developer/app/ProductionShowcaseAPI.java index 02bb984..3ad8580 100644 --- a/java/open-banking-simple-app/src/main/java/com/ing/developer/app/ProductionShowcaseAPI.java +++ b/java/open-banking-simple-app/src/main/java/com/ing/developer/app/ProductionShowcaseAPI.java @@ -4,7 +4,7 @@ import com.ing.developer.common.clients.Companion; import com.ing.developer.showcase.client.ApiClient; import com.ing.developer.showcase.client.ApiException; -import com.ing.developer.showcase.client.api.GreetingsApi; +import com.ing.developer.showcase.client.api.ShowcaseApiApi; import javax.ws.rs.client.ClientBuilder; import java.security.PrivateKey; @@ -21,7 +21,7 @@ public static void callShowcaseAPI() throws ApiException { Utils.Pair trustMaterial = Companion.Utils.createOpenBankingClient(keyStoreFileName, keyStorePassword, false, null, null, false, false); ApiClient clientAPI = new ApiClient(clientId, trustMaterial.getFirst(), trustMaterial.getSecond()); - GreetingsApi greetingsApi = new GreetingsApi(clientAPI); + ShowcaseApiApi greetingsApi = new ShowcaseApiApi(clientAPI); String greeting = greetingsApi.greetingsSingleGet(null).getMessage(); System.out.println(greeting); }