This commit is contained in:
Lucio Lelii 2018-03-02 10:43:36 +00:00
parent 63f585888e
commit ecd3b1535c
1 changed files with 13 additions and 8 deletions

View File

@ -29,19 +29,24 @@ public class CallTest {
@Test @Test
public void resolveNodeToken() throws Exception{ public void resolveNodeToken() throws Exception{
System.out.println(resolveToken("80048c62-26e0-4df3-a5ec-f893aee07243-843339462")); //81caac0f-8a0d-4923-9312-7ff0eb3f2d5e|98187548")); System.out.println(resolveToken("d29fdd99-0e88-4f13-ae33-f52258e9f578-843339462")); //81caac0f-8a0d-4923-9312-7ff0eb3f2d5e|98187548"));
System.out.println(resolveToken("d29fdd99-0e88-4f13-ae33-f52258e9f578-843339462").getClientInfo());
} }
@Test @Test
public void requestUserTokenViaUserNameAndScope() throws Exception { public void requestUserTokenViaUserNameAndScope() throws Exception {
System.out.println(authorizationService().resolveTokenByUserAndContext("alessandro.pieve", "/gcube/devsec")); System.out.println(authorizationService().resolveTokenByUserAndContext("valentina.marioli", "/gcube/devNext/NextNext"));
}
@Test
public void removeUserinContext() throws Exception {
authorizationService().removeAllReleatedToken("lucio.lelii", "/gcube/devsec");
} }
@Test @Test
public void requestExternalServiceToken() throws Exception { public void requestExternalServiceToken() throws Exception {
SecurityTokenProvider.instance.set(requestTestToken("/gcube/devsec")); SecurityTokenProvider.instance.set(requestTestToken("/gcube/devsec/NextNext"));
System.out.println(authorizationService().generateExternalServiceToken("OBISTest")); System.out.println(authorizationService().generateExternalServiceToken("org.gcube.datacatalogue.GRSFNotifier"));
} }
@Test @Test
@ -78,7 +83,7 @@ public class CallTest {
@Test @Test
public void generateToken() throws Exception{ public void generateToken() throws Exception{
System.out.println(authorizationService().generateUserToken(new UserInfo("alessandro.pieve", new ArrayList<String>()), "/gcube/devNext")); System.out.println(authorizationService().generateUserToken(new UserInfo("yankarlos.panikos", new ArrayList<String>()), "/gcube/devNext/NextNext"));
} }
@Test(expected=RuntimeException.class) @Test(expected=RuntimeException.class)
public void createKeyWithError() throws Exception { public void createKeyWithError() throws Exception {
@ -112,7 +117,7 @@ public class CallTest {
public String _requestNodeToken() throws Exception { public String _requestNodeToken() throws Exception {
SecurityTokenProvider.instance.set(requestTestToken("/gcube")); SecurityTokenProvider.instance.set(requestTestToken("/gcube"));
String token = authorizationService().requestActivation(new ContainerInfo("dlib29.isti.cnr.it",8080), "/gcube/devsec"); String token = authorizationService().requestActivation(new ContainerInfo("workspace-repository1-d.d4science.org",80), "/gcube");
return token; return token;
} }
@ -122,7 +127,7 @@ public class CallTest {
} }
private String requestTestToken(String context) throws Exception{ private String requestTestToken(String context) throws Exception{
return authorizationService().generateUserToken(new UserInfo("lucio.lelii", new ArrayList<String>()), context); return authorizationService().generateUserToken(new UserInfo("giancarlo.panichi", new ArrayList<String>()), context);
} }
private AuthorizationEntry resolveToken(String token) throws Exception{ private AuthorizationEntry resolveToken(String token) throws Exception{