diff --git a/.project b/.project
deleted file mode 100644
index cdb05cd..0000000
--- a/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- data-transfer-library
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.m2e.core.maven2Builder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.eclipse.m2e.core.maven2Nature
-
-
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9f4d4fc..628ce97 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for org.gcube.data.transfer.data-transfer-library
+##[v1.3.0-SNAPSHOT] 2020-12-01
+* Upgraded integration with security layer
+
+
##[v1.2.3] 2020-12-01
* Deletion method
diff --git a/pom.xml b/pom.xml
index 545ab22..002e4a6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.gcube.data.transfer
data-transfer-library
- 1.2.3
+ 1.3.0-SNAPSHOT
DataTransfer-library
Data Transfer Service client library
@@ -30,7 +30,7 @@
org.gcube.distribution
gcube-bom
- 2.0.0
+ 2.0.1
pom
import
diff --git a/src/main/java/org/gcube/data/transfer/library/utils/ScopeUtils.java b/src/main/java/org/gcube/data/transfer/library/utils/ScopeUtils.java
index ffad458..0905635 100644
--- a/src/main/java/org/gcube/data/transfer/library/utils/ScopeUtils.java
+++ b/src/main/java/org/gcube/data/transfer/library/utils/ScopeUtils.java
@@ -1,40 +1,17 @@
package org.gcube.data.transfer.library.utils;
-import org.gcube.common.authorization.library.AuthorizationEntry;
-import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
+import org.gcube.common.authorization.library.provider.AuthorizationProvider;
import org.gcube.common.scope.api.ScopeProvider;
-import static org.gcube.common.authorization.client.Constants.authorizationService;
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
public class ScopeUtils {
public static String getCurrentScope(){
- try{
- String token=SecurityTokenProvider.instance.get();
- log.debug("Token is : "+token);
- if(token==null) throw new Exception("Security Token is null");
- AuthorizationEntry entry = authorizationService().get(token);
- return entry.getContext();
- }catch(Exception e ){
- log.debug("Unable to resolve token, checking scope provider..",e);
- return ScopeProvider.instance.get();
- }
+ return ScopeProvider.instance.get();
}
public static String getCurrentCaller(){
- try{
- String token=SecurityTokenProvider.instance.get();
- log.debug("Token is : "+token);
- if(token==null) throw new Exception("Security Token is null");
- AuthorizationEntry entry = authorizationService().get(token);
- return entry.getClientInfo().getId();
- }catch(Exception e ){
- log.debug("Unable to resolve token, checking scope provider..",e);
- return "Unidentified data-transfer user";
- }
+ return AuthorizationProvider.instance.get().getClient().getId();
}
}
diff --git a/src/test/java/org/gcube/data/transfer/library/TestClientCalls.java b/src/test/java/org/gcube/data/transfer/library/TestClientCalls.java
index f31c84b..6ad4ab2 100644
--- a/src/test/java/org/gcube/data/transfer/library/TestClientCalls.java
+++ b/src/test/java/org/gcube/data/transfer/library/TestClientCalls.java
@@ -29,16 +29,21 @@ import org.junit.Test;
public class TestClientCalls {
-// static String scope="/pred4s/preprod/preVRE";
-// static String hostname="https://thredds-pre-d4s.d4science.org";
- static String hostname="https://geoserver1.dev.d4science.org";
+
static String scope="/gcube/devsec/devVRE";
+
+// static String scope="/pred4s/preprod/preVRE";
+ static String hostname="https://thredds.dev.d4science.org";
+// static String hostname="https://geona-proto.d4science.org";
+// static String scope="/d4science.research-infrastructures.eu/D4OS/GeoNA-Prototype";
static Client client;
static long testRun=System.currentTimeMillis();
@BeforeClass
public static void init() throws ServiceNotFoundException{
TokenSetter.set(scope);
+// String hostname=
+// new URL(SDIAbstractPlugin.management().build().getConfiguration().getByEngine(Engine.TH_ENGINE).get(0).getBaseEndpoint()).getHost();
client=new Client(hostname);
}