This commit is contained in:
Lucio Lelii 2016-09-30 10:22:58 +00:00
parent 0d7dbe67a5
commit e5c5e37594
3 changed files with 6 additions and 6 deletions

View File

@ -33,7 +33,7 @@ public interface AuthorizationProxy {
String generateUserToken(UserInfo client, String context)
throws Exception;
String requestActivation(ContainerInfo container, String context) throws Exception;
String requestActivation(ContainerInfo container) throws Exception;
public Map<String, String> retrieveApiKeys() throws Exception;

View File

@ -186,14 +186,13 @@ public class DefaultAuthorizationProxy implements AuthorizationProxy {
@Override
public String requestActivation(ContainerInfo container, String context) throws Exception {
public String requestActivation(ContainerInfo container) throws Exception {
String methodPath = "/token/node";
int infrastructureHash = Utils.getInfrastructureHashfromContext(context);
int infrastructureHash = Utils.getInfrastructureHashFromToken(SecurityTokenProvider.instance.get(), endpoints.getDefaultInfrastructure());
StringBuilder callUrl =
new StringBuilder(getInternalEnpoint(infrastructureHash)).append(methodPath).append("?")
.append(CONTEXT_PARAM).append("=").append(context);
new StringBuilder(getInternalEnpoint(infrastructureHash)).append(methodPath);
URL url = new URL(callUrl.toString());
HttpURLConnection connection = makeRequest(url, "PUT", false);

View File

@ -25,7 +25,8 @@ public class CallTest {
@Test
public void requestNodeToken() throws Exception {
String token = authorizationService().requestActivation(new ContainerInfo("node11.d.d4science.research-infrastructures.eu",8080), "/gcube/devNext/NextNext");
SecurityTokenProvider.instance.set(requestTestToken("/gcube/devNext/NextNext"));
String token = authorizationService().requestActivation(new ContainerInfo("node11.d.d4science.research-infrastructures.eu",8080));
System.out.println(token);
}