returning scopeMaps on token resolution
This commit is contained in:
parent
f9418df4ea
commit
f62a477b84
2
pom.xml
2
pom.xml
|
@ -11,7 +11,7 @@
|
|||
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>authorization-service</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.2-SNASPHOT</version>
|
||||
<name>authorization service</name>
|
||||
|
||||
<packaging>war</packaging>
|
||||
|
|
|
@ -34,6 +34,8 @@ import org.gcube.common.authorization.library.utils.MultiServiceTokenRequest;
|
|||
import org.gcube.common.authorizationservice.filters.AuthorizedCallFilter;
|
||||
import org.gcube.common.authorizationservice.util.Constants;
|
||||
import org.gcube.common.authorizationservice.util.TokenPersistence;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.api.ServiceMap;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
@ -70,8 +72,6 @@ public class TokenManager {
|
|||
.entity("token "+token+" not found").type(MediaType.TEXT_PLAIN).build());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
try{
|
||||
ScopeProvider.instance.set(info.getContext());
|
||||
ServiceMap map = ServiceMap.instance;
|
||||
|
@ -79,9 +79,7 @@ public class TokenManager {
|
|||
info.setMap(map);
|
||||
}catch(Exception e){
|
||||
log.error("error retrieving map for {}", info.getContext(), e);
|
||||
throw new WebApplicationException(Response.status(Response.Status.INTERNAL_SERVER_ERROR)
|
||||
.entity("Error retrieving map").type(MediaType.TEXT_PLAIN).build());
|
||||
}*/
|
||||
}
|
||||
|
||||
log.debug("returning info {}", info);
|
||||
return info;
|
||||
|
@ -106,6 +104,14 @@ public class TokenManager {
|
|||
for (String token : tokens ) {
|
||||
try {
|
||||
AuthorizationEntry info = persistence.getAuthorizationEntry(token);
|
||||
try{
|
||||
ScopeProvider.instance.set(info.getContext());
|
||||
ServiceMap map = ServiceMap.instance;
|
||||
ScopeProvider.instance.reset();
|
||||
info.setMap(map);
|
||||
}catch(Exception e){
|
||||
log.error("error retrieving map for {}", info.getContext(), e);
|
||||
}
|
||||
toReturn.add(info);
|
||||
}catch(Exception e) {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue