use of io.cryostat.net.MissingEnvironmentVariableException in project cryostat by cryostatio.
the class OpenShiftAuthManager method computeAuthorizationEndpoint.
private CompletableFuture<String> computeAuthorizationEndpoint() {
return oauthUrls.computeIfAbsent(AUTHORIZATION_URL_KEY, key -> {
try {
String oauthClient = this.getServiceAccountName();
String tokenScope = this.getTokenScope();
CompletableFuture<OAuthMetadata> oauthMetadata = this.computeOauthMetadata();
String authorizeEndpoint = oauthMetadata.get().getAuthorizationEndpoint();
URIBuilder builder = new URIBuilder(authorizeEndpoint);
builder.addParameter("client_id", oauthClient);
builder.addParameter("response_type", "token");
builder.addParameter("response_mode", "fragment");
builder.addParameter("scope", tokenScope);
return CompletableFuture.completedFuture(builder.build().toString());
} catch (ExecutionException | InterruptedException | URISyntaxException | MissingEnvironmentVariableException e) {
return CompletableFuture.failedFuture(e);
}
});
}
Aggregations