Skip to content

Commit

Permalink
Finally fixing - take 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ilgrosso committed Jul 28, 2023
1 parent a34658b commit b0111d1
Showing 1 changed file with 18 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,24 @@ protected static void oidcClientAppSetup(
clientApp.getSupportedGrantTypes().add(OIDCGrantType.authorization_code);

CLIENT_APP_SERVICE.update(ClientAppType.OIDCRP, clientApp);

await().atMost(60, TimeUnit.SECONDS).pollInterval(20, TimeUnit.SECONDS).until(() -> {
try {
String metadata = WebClient.create(
WA_ADDRESS + "/oidc/" + OidcConstants.WELL_KNOWN_OPENID_CONFIGURATION_URL).
get().readEntity(String.class);
if (!metadata.contains("groups")) {
WA_CONFIG_SERVICE.pushToWA(WAConfigService.PushSubject.conf, List.of());
throw new IllegalStateException();
}

return true;
} catch (Exception e) {
// ignore
}
return false;
});
WA_CONFIG_SERVICE.pushToWA(WAConfigService.PushSubject.clientApps, List.of());
}

@BeforeAll
Expand All @@ -165,8 +183,6 @@ public static void clientAppSetup() {

@Test
public void web() throws IOException {
WA_CONFIG_SERVICE.pushToWA(WAConfigService.PushSubject.clientApps, List.of());

CloseableHttpClient httpclient = HttpClients.createDefault();
HttpClientContext context = HttpClientContext.create();
context.setCookieStore(new BasicCookieStore());
Expand Down Expand Up @@ -264,25 +280,6 @@ protected boolean checkIdToken() {

@Test
public void rest() throws IOException, ParseException {
await().atMost(60, TimeUnit.SECONDS).pollInterval(20, TimeUnit.SECONDS).until(() -> {
try {
String metadata = WebClient.create(
WA_ADDRESS + "/oidc/" + OidcConstants.WELL_KNOWN_OPENID_CONFIGURATION_URL).
get().readEntity(String.class);
if (!metadata.contains("groups")) {
WA_CONFIG_SERVICE.pushToWA(WAConfigService.PushSubject.conf, List.of());
throw new IllegalStateException();
}

return true;
} catch (Exception e) {
// ignore
}
return false;
});
oidcClientAppSetup(getClass().getName(), SRA_REGISTRATION_ID, CLIENT_APP_ID, CLIENT_ID, CLIENT_SECRET);
WA_CONFIG_SERVICE.pushToWA(WAConfigService.PushSubject.clientApps, List.of());

// 0. access public route
WebClient client = WebClient.create(SRA_ADDRESS + "/public/post").
accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON);
Expand Down

0 comments on commit b0111d1

Please sign in to comment.