Skip to content

Commit

Permalink
Add web client and minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Janelle Law committed Nov 4, 2021
1 parent b4585fe commit 233d075
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/main/java/io/cryostat/net/OpenShiftAuthManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,10 @@ public class OpenShiftAuthManager extends AbstractAuthManager {
this.clientProvider = clientProvider;
this.webClient = webClient;
try {
authorizationUrl = this.computeAuthorizationEndpoint();
authorizationUrl = this.computeAuthorizationEndpoint().get();
} catch (ExecutionException | InterruptedException e) {
logger.error("OAuth endpoint retrieval failed", e.getMessage());
//throw new IOException(
// "OAuth server unreachable", e); // how to handle exceptions properly?
// how to handle exceptions properly?
}
}

Expand Down Expand Up @@ -318,7 +317,8 @@ public static String getAuthorizationEndpoint() {
return authorizationUrl;
}

private String computeAuthorizationEndpoint() throws ExecutionException, InterruptedException {
private Future<String> computeAuthorizationEndpoint()
throws ExecutionException, InterruptedException {
CompletableFuture<JsonObject> oauthMetadata = new CompletableFuture<>();
CompletableFuture<String> authUrl = new CompletableFuture<>();

Expand All @@ -336,7 +336,7 @@ private String computeAuthorizationEndpoint() throws ExecutionException, Interru
});

authUrl.complete(oauthMetadata.get().getString(OAUTH_ENDPOINT_KEY) + OAUTH_REQ_PARAMS);
return authUrl.get();
return authUrl;
}

@SuppressFBWarnings(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@

public class EmptyOpenShiftTokenException extends IOException {
public EmptyOpenShiftTokenException() {
super("Token cannot be empty");
super("Token is empty");
}
}
2 changes: 1 addition & 1 deletion web-client

0 comments on commit 233d075

Please sign in to comment.