2015-05-18 19:15:58 +02:00
|
|
|
package org.gcube.common.authorizationservice.cl;
|
|
|
|
|
|
|
|
import static org.gcube.common.authorization.client.Constants.authorizationService;
|
|
|
|
|
2015-11-27 18:06:28 +01:00
|
|
|
import java.util.ArrayList;
|
2015-05-29 18:32:43 +02:00
|
|
|
|
2016-05-13 17:00:54 +02:00
|
|
|
import org.gcube.common.authorization.library.AuthorizationEntry;
|
2016-01-22 17:28:17 +01:00
|
|
|
import org.gcube.common.authorization.library.provider.UserInfo;
|
2015-05-18 19:15:58 +02:00
|
|
|
import org.junit.Test;
|
2019-10-07 09:19:54 +02:00
|
|
|
|
2015-05-18 19:15:58 +02:00
|
|
|
public class CallTest {
|
2019-09-20 16:38:31 +02:00
|
|
|
|
2019-02-20 16:39:09 +01:00
|
|
|
@Test
|
|
|
|
public void haspred4s() {
|
|
|
|
System.out.println("pred4s".hashCode() & 0xfffffff);
|
|
|
|
}
|
|
|
|
|
2020-03-18 09:12:26 +01:00
|
|
|
@Test
|
|
|
|
public void getToken() throws Exception {
|
2023-11-06 16:36:55 +01:00
|
|
|
System.out.println(authorizationService().get("XXXXXXXX"));
|
|
|
|
//System.out.println(authorizationService().get("XXXXXXXX").getContext());
|
|
|
|
//System.out.println(authorizationService().get("XXXXXXXX").getMap());
|
2020-03-18 09:12:26 +01:00
|
|
|
}
|
2018-03-02 11:43:36 +01:00
|
|
|
|
|
|
|
@Test
|
|
|
|
public void removeUserinContext() throws Exception {
|
|
|
|
authorizationService().removeAllReleatedToken("lucio.lelii", "/gcube/devsec");
|
2016-11-16 12:11:14 +01:00
|
|
|
}
|
|
|
|
|
2016-10-04 15:00:12 +02:00
|
|
|
|
|
|
|
@Test
|
2016-11-16 12:11:14 +01:00
|
|
|
public void generateToken() throws Exception{
|
2019-02-20 16:39:09 +01:00
|
|
|
System.out.println(authorizationService().generateUserToken(new UserInfo("guest", new ArrayList<String>()), "/pred4s"));
|
2016-10-04 15:00:12 +02:00
|
|
|
}
|
|
|
|
|
2016-08-30 11:29:19 +02:00
|
|
|
@Test
|
|
|
|
public void createTestToken() throws Exception {
|
2019-02-20 16:39:09 +01:00
|
|
|
System.out.println(requestTestToken("/pred4s"));
|
2016-08-30 11:29:19 +02:00
|
|
|
}
|
2016-10-04 15:00:12 +02:00
|
|
|
|
2016-07-14 17:47:45 +02:00
|
|
|
private String requestTestToken(String context) throws Exception{
|
2019-02-20 16:39:09 +01:00
|
|
|
return authorizationService().generateUserToken(new UserInfo("lucio.lelii", new ArrayList<String>()), context);
|
2016-07-14 17:47:45 +02:00
|
|
|
}
|
2016-10-04 15:00:12 +02:00
|
|
|
|
2016-07-14 17:47:45 +02:00
|
|
|
private AuthorizationEntry resolveToken(String token) throws Exception{
|
|
|
|
AuthorizationEntry entry = authorizationService().get(token);
|
|
|
|
return entry;
|
|
|
|
}
|
2016-11-14 17:39:00 +01:00
|
|
|
|
|
|
|
|
2015-05-18 19:15:58 +02:00
|
|
|
}
|