From 1a720e09fdbd0845f612943f0950503bd5ee27df Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Fri, 25 Feb 2022 16:17:46 +0100 Subject: [PATCH 1/3] Switching to authorization-utils 2.X.X --- pom.xml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 3d282e6..230fae0 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ org.gcube.distribution gcube-smartgears-bom - 2.1.0 + 2.2.0-SNAPSHOT pom import @@ -67,7 +67,6 @@ org.gcube.common authorization-utils - [1.0.0,2.0.0-SNAPSHOT) org.gcube.information-system @@ -157,23 +156,19 @@ 1.8 - - - - - - - org.gcube.data-publishing storagehub-application-persistence [3.0.0,4.0.0-SNAPSHOT) + + org.json json 20211205 + org.apache.tika tika-core @@ -213,4 +208,4 @@ - \ No newline at end of file + From 0073fb84cecc499717935bbb49cedf065f12163a Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Fri, 25 Feb 2022 16:18:47 +0100 Subject: [PATCH 2/3] Removed Request Filter because SecremManager reset is no more needed --- .../org/gcube/gcat/rest/RequestFilter.java | 36 ------------------- 1 file changed, 36 deletions(-) delete mode 100644 src/main/java/org/gcube/gcat/rest/RequestFilter.java diff --git a/src/main/java/org/gcube/gcat/rest/RequestFilter.java b/src/main/java/org/gcube/gcat/rest/RequestFilter.java deleted file mode 100644 index 16a47a2..0000000 --- a/src/main/java/org/gcube/gcat/rest/RequestFilter.java +++ /dev/null @@ -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(); - } - -} From 51fc8627b86c0721aa17d487a64e948605544e95 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Mon, 28 Feb 2022 10:28:48 +0100 Subject: [PATCH 3/3] Improved code readibility --- .../java/org/gcube/gcat/persistence/ckan/CKANUserCache.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/gcube/gcat/persistence/ckan/CKANUserCache.java b/src/main/java/org/gcube/gcat/persistence/ckan/CKANUserCache.java index 9ff1f8c..34e610d 100644 --- a/src/main/java/org/gcube/gcat/persistence/ckan/CKANUserCache.java +++ b/src/main/java/org/gcube/gcat/persistence/ckan/CKANUserCache.java @@ -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 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();