Merge branch 'feature/22871' of code-repo.d4science.org:gCubeSystem/gcat
This commit is contained in:
commit
9d8ab9a828
10
pom.xml
10
pom.xml
|
@ -156,23 +156,19 @@
|
||||||
<version>1.8</version>
|
<version>1.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Used to automatically convert XML to JSON -->
|
|
||||||
<!-- <dependency> -->
|
|
||||||
<!-- <groupId>org.json</groupId> -->
|
|
||||||
<!-- <artifactId>json</artifactId> -->
|
|
||||||
<!-- <version>20140107</version> -->
|
|
||||||
<!-- </dependency> -->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.data-publishing</groupId>
|
<groupId>org.gcube.data-publishing</groupId>
|
||||||
<artifactId>storagehub-application-persistence</artifactId>
|
<artifactId>storagehub-application-persistence</artifactId>
|
||||||
<version>[3.0.0,4.0.0-SNAPSHOT)</version>
|
<version>[3.0.0,4.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Used to automatically convert XML to JSON -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.json</groupId>
|
<groupId>org.json</groupId>
|
||||||
<artifactId>json</artifactId>
|
<artifactId>json</artifactId>
|
||||||
<version>20211205</version>
|
<version>20211205</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.tika</groupId>
|
<groupId>org.apache.tika</groupId>
|
||||||
<artifactId>tika-core</artifactId>
|
<artifactId>tika-core</artifactId>
|
||||||
|
|
|
@ -37,14 +37,15 @@ public abstract class CKANUserCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CKANUser getCurrrentCKANUser() {
|
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);
|
Cache<String,CKANUser> userCache = userCachePerContext.get(context);
|
||||||
if(userCache == null) {
|
if(userCache == null) {
|
||||||
userCache = cacheManager.createCache(context, userCacheConfiguration);
|
userCache = cacheManager.createCache(context, userCacheConfiguration);
|
||||||
userCachePerContext.put(context, userCache);
|
userCachePerContext.put(context, userCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
String gcubeUsername = SecretManager.instance.get().getUser().getUsername();
|
String gcubeUsername = secretManager.getUser().getUsername();
|
||||||
CKANUser ckanUser = userCache.get(gcubeUsername);
|
CKANUser ckanUser = userCache.get(gcubeUsername);
|
||||||
if(ckanUser == null) {
|
if(ckanUser == null) {
|
||||||
ckanUser = new CKANUser();
|
ckanUser = new CKANUser();
|
||||||
|
|
|
@ -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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue