This commit is contained in:
Lucio Lelii 2016-05-13 15:00:54 +00:00
parent 25d931a9a1
commit 23e77bcc81
2 changed files with 9 additions and 4 deletions

View File

@ -12,6 +12,8 @@ import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.gcube.common.authorization.client.Binder; import org.gcube.common.authorization.client.Binder;
import org.gcube.common.authorization.client.exceptions.ObjectNotFound; import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
@ -30,7 +32,7 @@ public class DefaultAuthorizationProxy implements AuthorizationProxy {
private static Logger log = LoggerFactory.getLogger(AuthorizationProxy.class); private static Logger log = LoggerFactory.getLogger(AuthorizationProxy.class);
//private static Map<String, AuthorizationEntryCache> cache = new HashMap<String, AuthorizationEntryCache>(); private static Map<String, AuthorizationEntryCache> cache = new ConcurrentHashMap<String, AuthorizationEntryCache>();
private List<AuthorizationEndpoint> endpoints; private List<AuthorizationEndpoint> endpoints;
@ -86,8 +88,8 @@ public class DefaultAuthorizationProxy implements AuthorizationProxy {
@Override @Override
public AuthorizationEntry get(String token) throws ObjectNotFound, Exception{ public AuthorizationEntry get(String token) throws ObjectNotFound, Exception{
/*if (cache.containsKey(token) && cache.get(token).isValid()) if (cache.containsKey(token) && cache.get(token).isValid())
return cache.get(token).getEntry();*/ return cache.get(token).getEntry();
final String methodPath = "/retrieve/"; final String methodPath = "/retrieve/";

View File

@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.gcube.common.authorization.client.exceptions.ObjectNotFound; import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
import org.gcube.common.authorization.library.AuthorizationEntry;
import org.gcube.common.authorization.library.policies.Action; import org.gcube.common.authorization.library.policies.Action;
import org.gcube.common.authorization.library.policies.Policy; import org.gcube.common.authorization.library.policies.Policy;
import org.gcube.common.authorization.library.policies.ServiceAccess; import org.gcube.common.authorization.library.policies.ServiceAccess;
@ -19,7 +20,9 @@ public class CallTest {
@Test @Test
public void call() throws Exception{ public void call() throws Exception{
try{ try{
System.out.println(authorizationService().get("3b34750e-d39b-4d3c-924d-efcf7cc907c1")); AuthorizationEntry entry = authorizationService().get("3b34750e-d39b-4d3c-924d-efcf7cc907c1");
System.out.println(entry);
}catch(ObjectNotFound onf){ }catch(ObjectNotFound onf){
onf.printStackTrace(); onf.printStackTrace();
} }