
com.sap.cloudfoundry.client.facade.util.AuthorizationEndpointGetter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudfoundry-client-facade Show documentation
Show all versions of cloudfoundry-client-facade Show documentation
A facade of the official Cloud Foundry Java client
package com.sap.cloudfoundry.client.facade.util;
import java.util.Map;
import org.springframework.web.reactive.function.client.WebClient;
public class AuthorizationEndpointGetter {
private final WebClient webClient;
public AuthorizationEndpointGetter(WebClient webClient) {
this.webClient = webClient;
}
public String getAuthorizationEndpoint() {
return getAuthorizationEndpoint("");
}
public String getAuthorizationEndpoint(String controllerUrl) {
String response = webClient.get()
.uri(controllerUrl + "/")
.retrieve()
.bodyToMono(String.class)
.block();
return getLoginHref(response);
}
@SuppressWarnings("unchecked")
private String getLoginHref(String response) {
Map resource = JsonUtil.convertJsonToMap(response);
Map links = (Map) resource.get("links");
Map login = (Map) links.get("login");
return (String) login.get("href");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy