52 lines
1.6 KiB
Java
52 lines
1.6 KiB
Java
package org.gcube.common.authorizationservice.cl;
|
|
|
|
import static org.gcube.common.authorization.client.Constants.authorizationService;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import org.gcube.common.authorization.library.AuthorizationEntry;
|
|
import org.gcube.common.authorization.library.provider.UserInfo;
|
|
import org.junit.Test;
|
|
|
|
public class CallTest {
|
|
|
|
@Test
|
|
public void haspred4s() {
|
|
System.out.println("pred4s".hashCode() & 0xfffffff);
|
|
}
|
|
|
|
@Test
|
|
public void getToken() throws Exception {
|
|
System.out.println(authorizationService().get("2b04d8-2bda-4f5b-a07e-c0468f95ce3e-843339462"));
|
|
//System.out.println(authorizationService().get("25bd7116-59f3-46dc-8ff3-c5c1a31c95cf-980114272").getContext());
|
|
//System.out.println(authorizationService().get("b7c80297-e4ed-42ab-ab42-fdc0b8b0eabf-98187548").getMap());
|
|
}
|
|
|
|
@Test
|
|
public void removeUserinContext() throws Exception {
|
|
authorizationService().removeAllReleatedToken("lucio.lelii", "/gcube/devsec");
|
|
}
|
|
|
|
|
|
@Test
|
|
public void generateToken() throws Exception{
|
|
System.out.println(authorizationService().generateUserToken(new UserInfo("guest", new ArrayList<String>()), "/pred4s"));
|
|
}
|
|
|
|
@Test
|
|
public void createTestToken() throws Exception {
|
|
System.out.println(requestTestToken("/pred4s"));
|
|
}
|
|
|
|
private String requestTestToken(String context) throws Exception{
|
|
return authorizationService().generateUserToken(new UserInfo("lucio.lelii", new ArrayList<String>()), context);
|
|
}
|
|
|
|
private AuthorizationEntry resolveToken(String token) throws Exception{
|
|
AuthorizationEntry entry = authorizationService().get(token);
|
|
return entry;
|
|
}
|
|
|
|
|
|
}
|