This commit is contained in:
Lucio Lelii 2016-11-16 11:11:14 +00:00
parent ea17d5b6cf
commit 3e0fcc2485
2 changed files with 10 additions and 5 deletions

View File

@ -123,7 +123,7 @@ public class DefaultAuthorizationProxy implements AuthorizationProxy {
@Override @Override
public String resolveTokenByUserAndContext(String user, String context) throws ObjectNotFound, Exception { public String resolveTokenByUserAndContext(String user, String context) throws ObjectNotFound, Exception {
String methodPath = "/token/"; String methodPath = "/token/resolve/";
int infrastructureHash = Utils.getInfrastructureHashfromContext(context); int infrastructureHash = Utils.getInfrastructureHashfromContext(context);

View File

@ -33,6 +33,11 @@ public class CallTest {
} }
@Test
public void requestUserTokenViaUserNameAndScope() throws Exception {
System.out.println(authorizationService().resolveTokenByUserAndContext("alessandro.pieve", "/gcube/devsec"));
}
@Test @Test
public void requestNodeToken() throws Exception { public void requestNodeToken() throws Exception {
System.out.println(_requestNodeToken()); System.out.println(_requestNodeToken());
@ -60,8 +65,8 @@ public class CallTest {
} }
@Test @Test
public void requestToken() throws Exception{ public void generateToken() throws Exception{
System.out.println(authorizationService().generateUserToken(new UserInfo("test.gcube", new ArrayList<String>()), "/gcube/devsec")); System.out.println(authorizationService().generateUserToken(new UserInfo("alessandro.pieve", new ArrayList<String>()), "/gcube/devsec"));
} }
@Test(expected=RuntimeException.class) @Test(expected=RuntimeException.class)
public void createKeyWithError() throws Exception { public void createKeyWithError() throws Exception {
@ -94,8 +99,8 @@ public class CallTest {
} }
public String _requestNodeToken() throws Exception { public String _requestNodeToken() throws Exception {
SecurityTokenProvider.instance.set(requestTestToken("/d4science.research-infrastructures.eu")); SecurityTokenProvider.instance.set(requestTestToken("/gcube"));
String token = authorizationService().requestActivation(new ContainerInfo("node65.d4science.org",80), "/d4science.research-infrastructures.eu"); String token = authorizationService().requestActivation(new ContainerInfo("dlib29.isti.cnr.it",8080), "/gcube/devsec");
return token; return token;
} }