diff --git a/src/test/java/iudx/file/server/apiserver/integrationTests/RestAssuredConfiguration.java b/src/test/java/iudx/file/server/apiserver/integrationTests/RestAssuredConfiguration.java index d17905b..36ec8cd 100644 --- a/src/test/java/iudx/file/server/apiserver/integrationTests/RestAssuredConfiguration.java +++ b/src/test/java/iudx/file/server/apiserver/integrationTests/RestAssuredConfiguration.java @@ -54,7 +54,6 @@ public void beforeAll(ExtensionContext context) { JsonObject config = fileServerConfig.configLoader(0, vertx); JsonObject testValues = config.getJsonObject("testValues"); Boolean isSsl = config.getBoolean("ssl"); - rsId = testValues.getString("rsId"); openRsId = testValues.getString("openRsId"); openRsGroupId = testValues.getString("openRsGroupId"); @@ -63,6 +62,7 @@ public void beforeAll(ExtensionContext context) { JsonObject config2 = fileServerConfig.configLoader(1, vertx); String authServerHost = config2.getString("authHost"); + String audience = config2.getString("audience"); boolean testOnDepl = Boolean.parseBoolean(System.getProperty("intTestDepl")); if (testOnDepl) { @@ -102,7 +102,7 @@ public void beforeAll(ExtensionContext context) { proxy(proxyHost, Integer.parseInt(proxyPort)); } logger.info("setting up the tokens"); - TokenSetup.setupTokens(authEndpoint, clientId, clientSecret, delegationId); + TokenSetup.setupTokens(authEndpoint, clientId, clientSecret, delegationId,audience); // Wait for tokens to be available before proceeding waitForTokens(); diff --git a/src/test/java/iudx/file/server/authenticator/TokenSetup.java b/src/test/java/iudx/file/server/authenticator/TokenSetup.java index 6685795..000ed77 100644 --- a/src/test/java/iudx/file/server/authenticator/TokenSetup.java +++ b/src/test/java/iudx/file/server/authenticator/TokenSetup.java @@ -13,8 +13,10 @@ public class TokenSetup { private static final Logger logger = LoggerFactory.getLogger(TokenSetup.class); private static WebClient webClient; + private static String audience4Admin; - public static void setupTokens(String authEndpoint, String clientId, String clientSecret, String delegationId) { + public static void setupTokens(String authEndpoint, String clientId, String clientSecret, String delegationId, String audience) { + audience4Admin = audience; // Fetch tokens asynchronously and wait for all completions CompositeFuture.all( fetchToken("openResourceToken", authEndpoint, clientId, clientSecret), @@ -99,6 +101,7 @@ private static Future fetchToken(String userType, String authEndpoint, S } promise.complete(accessToken); } else { + logger.error("error : "+response.bodyAsString()); promise.fail("Failed to get token. Status code: " + response.statusCode()); } return Future.succeededFuture(); @@ -129,7 +132,7 @@ private static JsonObject getPayload(String userType) { jsonPayload.put("role", "consumer"); break; case "adminToken": - jsonPayload.put("itemId", "rs.iudx.io"); + jsonPayload.put("itemId", audience4Admin); jsonPayload.put("itemType", "resource_server"); jsonPayload.put("role", "admin"); break;