Merge branch 'feature/22871' of code-repo.d4science.org:gCubeSystem/gcat into feature/22871

This commit is contained in:
Luca Frosini 2022-02-28 15:05:18 +01:00
commit c0cca0aa07
3 changed files with 6 additions and 46 deletions

11
pom.xml
View File

@ -67,7 +67,6 @@
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-utils</artifactId>
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.information-system</groupId>
@ -157,23 +156,19 @@
<version>1.8</version>
</dependency>
<!-- Used to automatically convert XML to JSON -->
<!-- <dependency> -->
<!-- <groupId>org.json</groupId> -->
<!-- <artifactId>json</artifactId> -->
<!-- <version>20140107</version> -->
<!-- </dependency> -->
<dependency>
<groupId>org.gcube.data-publishing</groupId>
<artifactId>storagehub-application-persistence</artifactId>
<version>[3.0.0,4.0.0-SNAPSHOT)</version>
</dependency>
<!-- Used to automatically convert XML to JSON -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20211205</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>

View File

@ -37,14 +37,15 @@ public abstract class CKANUserCache {
}
public static CKANUser getCurrrentCKANUser() {
String context = SecretManager.instance.get().getContext();
SecretManager secretManager = SecretManager.instance.get();
String context = secretManager.getContext();
Cache<String,CKANUser> userCache = userCachePerContext.get(context);
if(userCache == null) {
userCache = cacheManager.createCache(context, userCacheConfiguration);
userCachePerContext.put(context, userCache);
}
String gcubeUsername = SecretManager.instance.get().getUser().getUsername();
String gcubeUsername = secretManager.getUser().getUsername();
CKANUser ckanUser = userCache.get(gcubeUsername);
if(ckanUser == null) {
ckanUser = new CKANUser();

View File

@ -1,36 +0,0 @@
package org.gcube.gcat.rest;
import java.io.IOException;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.container.PreMatching;
import javax.ws.rs.ext.Provider;
import org.gcube.common.authorization.utils.manager.SecretManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Provider
@PreMatching
public class RequestFilter implements ContainerRequestFilter, ContainerResponseFilter {
private final static Logger logger = LoggerFactory.getLogger(RequestFilter.class);
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
logger.trace("PreMatching RequestFilter");
SecretManager.instance.remove();
SecretManager.instance.get();
}
@Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
throws IOException {
logger.trace("ResponseFilter");
SecretManager.instance.remove();
}
}