parent
196429c84b
commit
c1abd152e3
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,8 +7,14 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="uri-resolver-2.7.3">
|
|
||||||
|
|
||||||
|
|
||||||
|
<wb-module deploy-name="uri-resolver-2.8.1-SNAPSHOT">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +23,10 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +35,10 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +47,10 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,10 +59,10 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
<dependent-module archiveName="uri-resolver-manager-1.5.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/uri-resolver-manager/uri-resolver-manager">
|
|
||||||
<dependency-type>uses</dependency-type>
|
|
||||||
</dependent-module>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,7 +71,10 @@
|
||||||
|
|
||||||
|
|
||||||
<property name="context-root" value="uri-resolver"/>
|
<property name="context-root" value="uri-resolver"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,7 +83,10 @@
|
||||||
|
|
||||||
|
|
||||||
<property name="java-output-path" value="/uri-resolver/target/classes"/>
|
<property name="java-output-path" value="/uri-resolver/target/classes"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,7 +95,10 @@
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
15
CHANGELOG.md
15
CHANGELOG.md
|
@ -4,11 +4,22 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [v2.7.3] - 2022-04-27
|
## [v2.8.1-SNAPSHOT] - 2022-06-13
|
||||||
|
|
||||||
|
**New**
|
||||||
|
|
||||||
|
- [#23156] CatalogueResolver enhanced to manage (create/resolve) an input query string
|
||||||
|
|
||||||
**Bug Fixing**
|
**Bug Fixing**
|
||||||
|
|
||||||
- [#23213] Fixing NoClassDefFoundError: org/geotoolkit/xml/XML
|
- [#23495] Removed the check on the gcube token stored in thread local. The working context of VRE will be checked from ScopeProvider
|
||||||
|
|
||||||
|
|
||||||
|
## [v2.7.3-SNAPSHOT] - 2022-04-27
|
||||||
|
|
||||||
|
**Bug Fixing**
|
||||||
|
|
||||||
|
- [#23213] Fixed NoClassDefFoundError: org/geotoolkit/xml/XML
|
||||||
|
|
||||||
## [v2.7.2] - 2022-04-06
|
## [v2.7.2] - 2022-04-06
|
||||||
|
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -9,7 +9,7 @@
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.gcube.data.transfer</groupId>
|
<groupId>org.gcube.data.transfer</groupId>
|
||||||
<artifactId>uri-resolver</artifactId>
|
<artifactId>uri-resolver</artifactId>
|
||||||
<version>2.7.3</version>
|
<version>2.8.1-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<description>The URI Resolver is an HTTP URI resolver implemented as a REST service which gives access trough HTTP to different gcube Resolvers and gCube Applications.</description>
|
<description>The URI Resolver is an HTTP URI resolver implemented as a REST service which gives access trough HTTP to different gcube Resolvers and gCube Applications.</description>
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@
|
||||||
<version>4.8.2</version>
|
<version>4.8.2</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -5,15 +5,14 @@ package org.gcube.datatransfer.resolver.catalogue;
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
* Mar 24, 2022
|
* Apr 20, 2022
|
||||||
*
|
|
||||||
* Binding Catalogue Request as a JSON
|
|
||||||
*/
|
*/
|
||||||
public class CatalogueRequest {
|
public class CatalogueRequest {
|
||||||
|
|
||||||
private String gcube_scope;
|
private String gcube_scope;
|
||||||
private String entity_context;
|
private String entity_context;
|
||||||
private String entity_name;
|
private String entity_name;
|
||||||
|
private String query_string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the gcube_scope.
|
* Gets the gcube_scope.
|
||||||
|
@ -42,19 +41,22 @@ public class CatalogueRequest {
|
||||||
return entity_name;
|
return entity_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the query string.
|
||||||
|
*
|
||||||
|
* @return the query string
|
||||||
|
*/
|
||||||
|
public String getQuery_string() {
|
||||||
|
return query_string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To string.
|
* To string.
|
||||||
*
|
*
|
||||||
* @return the string
|
* @return the string
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see java.lang.Object#toString()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("CatalogueRequest [gcube_scope=");
|
builder.append("CatalogueRequest [gcube_scope=");
|
||||||
builder.append(gcube_scope);
|
builder.append(gcube_scope);
|
||||||
|
@ -62,6 +64,8 @@ public class CatalogueRequest {
|
||||||
builder.append(entity_context);
|
builder.append(entity_context);
|
||||||
builder.append(", entity_name=");
|
builder.append(", entity_name=");
|
||||||
builder.append(entity_name);
|
builder.append(entity_name);
|
||||||
|
builder.append(", query_string=");
|
||||||
|
builder.append(query_string);
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,12 +94,12 @@ public class CatalogueStaticConfigurations{
|
||||||
if(toPrivateCKANCatalogueURL.startsWith(prefix)) {
|
if(toPrivateCKANCatalogueURL.startsWith(prefix)) {
|
||||||
toPrivateCKANCatalogueURL = toPrivateCKANCatalogueURL.replaceFirst(prefix, ""); //removing prefix
|
toPrivateCKANCatalogueURL = toPrivateCKANCatalogueURL.replaceFirst(prefix, ""); //removing prefix
|
||||||
String catalogueName = toPrivateCKANCatalogueURL.substring(0,toPrivateCKANCatalogueURL.indexOf(".d4science"));
|
String catalogueName = toPrivateCKANCatalogueURL.substring(0,toPrivateCKANCatalogueURL.indexOf(".d4science"));
|
||||||
LOG.info("Catalogue Name extration returning value: "+catalogueName);
|
LOG.info("Catalogue Name extraction returning value: "+catalogueName);
|
||||||
return catalogueName;
|
return catalogueName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.info("Catalogue Name extration returning null");
|
LOG.info("Catalogue Name extraction returning null");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,6 @@ import org.gcube.common.storagehub.model.Metadata;
|
||||||
import org.gcube.data.analysis.dminvocation.ActionType;
|
import org.gcube.data.analysis.dminvocation.ActionType;
|
||||||
import org.gcube.data.analysis.dminvocation.DataMinerInvocationManager;
|
import org.gcube.data.analysis.dminvocation.DataMinerInvocationManager;
|
||||||
import org.gcube.data.analysis.dminvocation.model.DataMinerInvocation;
|
import org.gcube.data.analysis.dminvocation.model.DataMinerInvocation;
|
||||||
import org.gcube.datatransfer.resolver.requesthandler.RequestHandler;
|
|
||||||
import org.gcube.datatransfer.resolver.services.error.ExceptionManager;
|
import org.gcube.datatransfer.resolver.services.error.ExceptionManager;
|
||||||
import org.gcube.datatransfer.resolver.services.exceptions.InternalServerException;
|
import org.gcube.datatransfer.resolver.services.exceptions.InternalServerException;
|
||||||
import org.gcube.datatransfer.resolver.util.ScopeUtil;
|
import org.gcube.datatransfer.resolver.util.ScopeUtil;
|
||||||
|
@ -119,20 +118,11 @@ public class AnalyticsCreateResolver {
|
||||||
|
|
||||||
logger.debug("The body contains the request: " + jsonRequest.toString());
|
logger.debug("The body contains the request: " + jsonRequest.toString());
|
||||||
|
|
||||||
String contextToken = SecurityTokenProvider.instance.get();
|
|
||||||
String scope = ScopeProvider.instance.get();
|
String scope = ScopeProvider.instance.get();
|
||||||
// logger.info("SecurityTokenProvider contextToken: "+contextToken);
|
// logger.info("SecurityTokenProvider contextToken: "+contextToken);
|
||||||
logger.info("ScopeProvider has scope: " + scope);
|
logger.info("ScopeProvider has scope: " + scope);
|
||||||
|
|
||||||
String appToken = req.getServletContext().getInitParameter(RequestHandler.ROOT_APP_TOKEN);
|
|
||||||
|
|
||||||
if (contextToken.compareTo(appToken) == 0) {
|
|
||||||
logger.error("Token not passed, SecurityTokenProvider contains the root app token: "
|
|
||||||
+ appToken.substring(0, 10) + "...");
|
|
||||||
throw ExceptionManager.unauthorizedException(req,
|
|
||||||
"You are not authorized. You must pass a token of VRE", this.getClass(), helpURI);
|
|
||||||
}
|
|
||||||
|
|
||||||
String operatorID = jsonRequest.getOperatorId();
|
String operatorID = jsonRequest.getOperatorId();
|
||||||
|
|
||||||
if (scope == null || scope.isEmpty()) {
|
if (scope == null || scope.isEmpty()) {
|
||||||
|
@ -148,8 +138,15 @@ public class AnalyticsCreateResolver {
|
||||||
"Mandatory body parameter 'operatorId' not found or empty in the JSON object", this.getClass(),
|
"Mandatory body parameter 'operatorId' not found or empty in the JSON object", this.getClass(),
|
||||||
helpURI);
|
helpURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopeBean scopeBean = new ScopeBean(scope);
|
ScopeBean scopeBean = new ScopeBean(scope);
|
||||||
|
if (scopeBean.is(Type.INFRASTRUCTURE) || scopeBean.is(Type.VO)) {
|
||||||
|
logger.error(Type.INFRASTRUCTURE + "or " + Type.VO + " scope detected, you must set a scope of VRE");
|
||||||
|
throw ExceptionManager.unauthorizedException(req,
|
||||||
|
"You are not authorized. You must pass a token of VRE", this.getClass(), helpURI);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
String publicLinkToDMInvFile = "";
|
String publicLinkToDMInvFile = "";
|
||||||
|
|
||||||
if (scopeBean.is(Type.VRE)) {
|
if (scopeBean.is(Type.VRE)) {
|
||||||
|
@ -162,7 +159,8 @@ public class AnalyticsCreateResolver {
|
||||||
|
|
||||||
File tempInvocationFile = null;
|
File tempInvocationFile = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
String contextToken = SecurityTokenProvider.instance.get();
|
||||||
String xmlRequest = DataMinerInvocationManager.getInstance().marshalingXML(jsonRequest, true, true);
|
String xmlRequest = DataMinerInvocationManager.getInstance().marshalingXML(jsonRequest, true, true);
|
||||||
String uniqueName = createDMInvocationFileName(jsonRequest.getOperatorId());
|
String uniqueName = createDMInvocationFileName(jsonRequest.getOperatorId());
|
||||||
tempInvocationFile = createTempFile(uniqueName, ".xml", xmlRequest.getBytes());
|
tempInvocationFile = createTempFile(uniqueName, ".xml", xmlRequest.getBytes());
|
||||||
|
@ -186,8 +184,9 @@ public class AnalyticsCreateResolver {
|
||||||
|
|
||||||
StorageHubManagement storageHubManagement = new StorageHubManagement();
|
StorageHubManagement storageHubManagement = new StorageHubManagement();
|
||||||
Metadata metadata = new Metadata();
|
Metadata metadata = new Metadata();
|
||||||
Map<String, String> theMap = new HashMap<String, String>();
|
Map<String, Object> theMap = new HashMap<String, Object>();
|
||||||
theMap.put("owner", owner);
|
theMap.put("owner", owner);
|
||||||
|
metadata.setMap(theMap);
|
||||||
URL thePublicLink = null;
|
URL thePublicLink = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.common.scope.impl.ScopeBean;
|
import org.gcube.common.scope.impl.ScopeBean;
|
||||||
import org.gcube.common.scope.impl.ScopeBean.Type;
|
import org.gcube.common.scope.impl.ScopeBean.Type;
|
||||||
|
@ -111,8 +112,19 @@ public class CatalogueResolver {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
itemCatalogueURL = itemCatalogueURLs.getPrivateVRECataloguePortletURL();
|
itemCatalogueURL = itemCatalogueURLs.getPrivateVRECataloguePortletURL();
|
||||||
logger.info("The dataset " + itemCatalogueURLs.getItemName()
|
logger.info("Either the " + itemCatalogueURLs.getItemName()
|
||||||
+ " is a private item (to VRE) so using protected access to CKAN portlet: " + itemCatalogueURL);
|
+ " is not an item (alias dataset) or it is a private item (to VRE) so using protected access to CKAN portlet: "
|
||||||
|
+ itemCatalogueURL);
|
||||||
|
}
|
||||||
|
|
||||||
|
String queryString = req.getQueryString();
|
||||||
|
if (queryString != null) {
|
||||||
|
logger.info("Query string found: " + queryString);
|
||||||
|
byte[] stringEncBytes = Base64.encodeBase64(queryString.getBytes());
|
||||||
|
String queryStringEnc = "query_string=" + new String(stringEncBytes);
|
||||||
|
logger.info("Adding Base64 encoded: " + queryString);
|
||||||
|
itemCatalogueURL += itemCatalogueURL.contains("?") ? "&" : "?";
|
||||||
|
itemCatalogueURL += queryStringEnc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response.seeOther(new URL(itemCatalogueURL).toURI()).build();
|
return Response.seeOther(new URL(itemCatalogueURL).toURI()).build();
|
||||||
|
@ -190,6 +202,11 @@ public class CatalogueResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
String linkURL = String.format("%s/%s/%s/%s", serverUrl, rc.getId(), vreName, jsonRequest.getEntity_name());
|
String linkURL = String.format("%s/%s/%s/%s", serverUrl, rc.getId(), vreName, jsonRequest.getEntity_name());
|
||||||
|
|
||||||
|
if (jsonRequest.getQuery_string() != null) {
|
||||||
|
linkURL += "?" + jsonRequest.getQuery_string();
|
||||||
|
}
|
||||||
|
|
||||||
logger.info("Returining Catalogue URL: " + linkURL);
|
logger.info("Returining Catalogue URL: " + linkURL);
|
||||||
return Response.ok(linkURL).header("Location", linkURL).build();
|
return Response.ok(linkURL).header("Location", linkURL).build();
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,9 @@ import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.common.scope.impl.ScopeBean;
|
import org.gcube.common.scope.impl.ScopeBean;
|
||||||
import org.gcube.common.scope.impl.ScopeBean.Type;
|
import org.gcube.common.scope.impl.ScopeBean.Type;
|
||||||
import org.gcube.datatransfer.resolver.requesthandler.RequestHandler;
|
|
||||||
import org.gcube.datatransfer.resolver.services.error.ExceptionManager;
|
import org.gcube.datatransfer.resolver.services.error.ExceptionManager;
|
||||||
import org.gcube.datatransfer.resolver.util.Util;
|
import org.gcube.datatransfer.resolver.util.Util;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -60,22 +58,18 @@ public class KnimeCreateResolver {
|
||||||
logger.info(this.getClass().getSimpleName() + " POST starts...");
|
logger.info(this.getClass().getSimpleName() + " POST starts...");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String contextToken = SecurityTokenProvider.instance.get();
|
|
||||||
String scope = ScopeProvider.instance.get();
|
String scope = ScopeProvider.instance.get();
|
||||||
// logger.info("SecurityTokenProvider contextToken: "+contextToken);
|
// logger.info("SecurityTokenProvider contextToken: "+contextToken);
|
||||||
logger.info("ScopeProvider has scope: " + scope);
|
logger.info("ScopeProvider has scope: " + scope);
|
||||||
|
|
||||||
String appToken = req.getServletContext().getInitParameter(RequestHandler.ROOT_APP_TOKEN);
|
ScopeBean scopeBean = new ScopeBean(scope);
|
||||||
|
if (scopeBean.is(Type.INFRASTRUCTURE) || scopeBean.is(Type.VO)) {
|
||||||
if (contextToken.compareTo(appToken) == 0) {
|
logger.error(Type.INFRASTRUCTURE + "or " + Type.VO + " scope detected, you must set a scope of VRE");
|
||||||
logger.error("Token not passed, SecurityTokenProvider contains the root app token: "
|
|
||||||
+ appToken.substring(0, 10) + "...");
|
|
||||||
throw ExceptionManager.unauthorizedException(req,
|
throw ExceptionManager.unauthorizedException(req,
|
||||||
"You are not authorized. You must pass a token of VRE", this.getClass(), helpURI);
|
"You are not authorized. You must pass a token of VRE", this.getClass(), helpURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopeBean scopeBean = new ScopeBean(scope);
|
|
||||||
|
|
||||||
if (scopeBean.is(Type.VRE)) {
|
if (scopeBean.is(Type.VRE)) {
|
||||||
|
|
||||||
String vreName = scopeBean.name();
|
String vreName = scopeBean.name();
|
||||||
|
|
|
@ -22,12 +22,12 @@ import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
|
||||||
import org.gcube.common.encryption.StringEncrypter;
|
import org.gcube.common.encryption.StringEncrypter;
|
||||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||||
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.datatransfer.resolver.requesthandler.RequestHandler;
|
import org.gcube.common.scope.impl.ScopeBean;
|
||||||
|
import org.gcube.common.scope.impl.ScopeBean.Type;
|
||||||
import org.gcube.datatransfer.resolver.services.error.ExceptionManager;
|
import org.gcube.datatransfer.resolver.services.error.ExceptionManager;
|
||||||
import org.gcube.datatransfer.resolver.services.exceptions.NotFoundException;
|
import org.gcube.datatransfer.resolver.services.exceptions.NotFoundException;
|
||||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
|
@ -72,15 +72,12 @@ public class WekeoResolver {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String contextToken = SecurityTokenProvider.instance.get();
|
|
||||||
String scope = ScopeProvider.instance.get();
|
String scope = ScopeProvider.instance.get();
|
||||||
logger.info("ScopeProvider has scope: " + scope);
|
logger.info("ScopeProvider has scope: " + scope);
|
||||||
|
|
||||||
String appToken = req.getServletContext().getInitParameter(RequestHandler.ROOT_APP_TOKEN);
|
ScopeBean scopeBean = new ScopeBean(scope);
|
||||||
|
if (scopeBean.is(Type.INFRASTRUCTURE) || scopeBean.is(Type.VO)) {
|
||||||
if (contextToken.compareTo(appToken) == 0) {
|
logger.error(Type.INFRASTRUCTURE + "or " + Type.VO + " scope detected, you must set a scope of VRE");
|
||||||
logger.error("Token not passed, SecurityTokenProvider contains the root app token: "
|
|
||||||
+ appToken.substring(0, 10) + "...");
|
|
||||||
throw ExceptionManager.unauthorizedException(req,
|
throw ExceptionManager.unauthorizedException(req,
|
||||||
"You are not authorized. You must pass a token of VRE", this.getClass(), helpURI);
|
"You are not authorized. You must pass a token of VRE", this.getClass(), helpURI);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,19 +15,10 @@ import java.nio.file.StandardCopyOption;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
import javax.ws.rs.core.Response.ResponseBuilder;
|
|
||||||
|
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.http.HttpStatus;
|
import org.apache.http.HttpStatus;
|
||||||
import org.gcube.common.storagehub.client.StreamDescriptor;
|
|
||||||
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
|
|
||||||
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
|
||||||
import org.gcube.datatransfer.resolver.applicationprofile.ApplicationProfileReader;
|
import org.gcube.datatransfer.resolver.applicationprofile.ApplicationProfileReader;
|
||||||
import org.gcube.datatransfer.resolver.services.StorageHubResolver;
|
|
||||||
import org.gcube.datatransfer.resolver.services.error.ExceptionManager;
|
|
||||||
import org.gcube.datatransfer.resolver.shub.StorageHubMetadataResponseBuilder;
|
|
||||||
import org.gcube.datatransfer.resolver.util.HTTPCallsUtils;
|
import org.gcube.datatransfer.resolver.util.HTTPCallsUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -42,7 +33,7 @@ import org.slf4j.LoggerFactory;
|
||||||
public class TestResolvers {
|
public class TestResolvers {
|
||||||
|
|
||||||
|
|
||||||
public static final String URI_RESOLVER_SERVICE_ENDPOINT = "https://data1-d.d4science.net";
|
public static final String URI_RESOLVER_SERVICE_ENDPOINT = "https://data.dev.d4science.org";
|
||||||
|
|
||||||
public static final Logger logger = LoggerFactory.getLogger(TestResolvers.class);
|
public static final Logger logger = LoggerFactory.getLogger(TestResolvers.class);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue