|
|
|
@ -18,6 +18,7 @@ import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Map.Entry;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import javax.net.ssl.HttpsURLConnection;
|
|
|
|
|
|
|
|
|
@ -113,6 +114,10 @@ public class DefaultAuthorizationProxy implements AuthorizationProxy {
|
|
|
|
|
|
|
|
|
|
StringBuilder callUrl = new StringBuilder(getInternalEnpoint(infrastructureHash)).append(methodPath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> realTokens = containerTokens.stream().map(t -> Utils.getRealToken(t)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
URL url = new URL(callUrl.toString());
|
|
|
|
|
HttpURLConnection connection = makeRequest(url, "PUT", true);
|
|
|
|
|
connection.setDoOutput(true);
|
|
|
|
@ -120,7 +125,7 @@ public class DefaultAuthorizationProxy implements AuthorizationProxy {
|
|
|
|
|
connection.setRequestProperty("Content-type", "application/xml");
|
|
|
|
|
|
|
|
|
|
try(OutputStream os = new BufferedOutputStream(connection.getOutputStream())){
|
|
|
|
|
Binder.getContext().createMarshaller().marshal(new MultiServiceTokenRequest(containerTokens, client), os);
|
|
|
|
|
Binder.getContext().createMarshaller().marshal(new MultiServiceTokenRequest(realTokens, client), os);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.debug("response code for "+callUrl.toString()+" is "+connection.getResponseCode()+" "+connection.getResponseMessage());
|
|
|
|
@ -264,6 +269,7 @@ public class DefaultAuthorizationProxy implements AuthorizationProxy {
|
|
|
|
|
public void removeAllReleatedToken(String clientId, String context) throws Exception{
|
|
|
|
|
String methodPath = "/token/user";
|
|
|
|
|
int infrastructureHash = Utils.getInfrastructureHashfromContext(context);
|
|
|
|
|
|
|
|
|
|
StringBuilder callUrl = new StringBuilder(getInternalEnpoint(infrastructureHash)).append(methodPath).append("?")
|
|
|
|
|
.append(CONTEXT_PARAM).append("=").append(context).append("&").append(CLIENT_ID_PARAM).append("=").append(clientId);
|
|
|
|
|
|
|
|
|
@ -277,6 +283,7 @@ public class DefaultAuthorizationProxy implements AuthorizationProxy {
|
|
|
|
|
if (connection.getResponseCode()!=200 && connection.getResponseCode()!=204) throw new Exception("error contacting authorization service");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String generateApiKey(String apiQualifier) throws Exception {
|
|
|
|
@ -507,13 +514,19 @@ public class DefaultAuthorizationProxy implements AuthorizationProxy {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final String methodPath = "/resolve/?";
|
|
|
|
|
final String methodPath = "/token/resolve/?";
|
|
|
|
|
|
|
|
|
|
StringBuilder callUrl = new StringBuilder(getInternalEnpoint(endpoint))
|
|
|
|
|
.append(methodPath);
|
|
|
|
|
|
|
|
|
|
for (String toAppend : realTokens)
|
|
|
|
|
callUrl= callUrl.append("token=").append(toAppend);
|
|
|
|
|
boolean first = true;
|
|
|
|
|
for (String toAppend : realTokens) {
|
|
|
|
|
if (first) {
|
|
|
|
|
callUrl= callUrl.append("token=").append(toAppend);
|
|
|
|
|
first = false;
|
|
|
|
|
} else callUrl= callUrl.append("&token=").append(toAppend);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
URL url = new URL(callUrl.toString());
|
|
|
|
|
HttpURLConnection connection = makeRequest(url, "GET", false);
|
|
|
|
|