git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/Common/authorization-common-client@132169 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0d7dbe67a5
commit
e5c5e37594
|
@ -33,7 +33,7 @@ public interface AuthorizationProxy {
|
||||||
String generateUserToken(UserInfo client, String context)
|
String generateUserToken(UserInfo client, String context)
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
|
||||||
String requestActivation(ContainerInfo container, String context) throws Exception;
|
String requestActivation(ContainerInfo container) throws Exception;
|
||||||
|
|
||||||
public Map<String, String> retrieveApiKeys() throws Exception;
|
public Map<String, String> retrieveApiKeys() throws Exception;
|
||||||
|
|
||||||
|
|
|
@ -186,14 +186,13 @@ public class DefaultAuthorizationProxy implements AuthorizationProxy {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String requestActivation(ContainerInfo container, String context) throws Exception {
|
public String requestActivation(ContainerInfo container) throws Exception {
|
||||||
|
|
||||||
String methodPath = "/token/node";
|
String methodPath = "/token/node";
|
||||||
|
|
||||||
int infrastructureHash = Utils.getInfrastructureHashfromContext(context);
|
int infrastructureHash = Utils.getInfrastructureHashFromToken(SecurityTokenProvider.instance.get(), endpoints.getDefaultInfrastructure());
|
||||||
StringBuilder callUrl =
|
StringBuilder callUrl =
|
||||||
new StringBuilder(getInternalEnpoint(infrastructureHash)).append(methodPath).append("?")
|
new StringBuilder(getInternalEnpoint(infrastructureHash)).append(methodPath);
|
||||||
.append(CONTEXT_PARAM).append("=").append(context);
|
|
||||||
|
|
||||||
URL url = new URL(callUrl.toString());
|
URL url = new URL(callUrl.toString());
|
||||||
HttpURLConnection connection = makeRequest(url, "PUT", false);
|
HttpURLConnection connection = makeRequest(url, "PUT", false);
|
||||||
|
|
|
@ -25,7 +25,8 @@ public class CallTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void requestNodeToken() throws Exception {
|
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);
|
System.out.println(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue