Compare commits
105 Commits
Author | SHA1 | Date |
---|---|---|
Giancarlo Panichi | c2bf4e3d2c | |
Giancarlo Panichi | 444efec4ca | |
Giancarlo Panichi | 527f98d0a5 | |
Giancarlo Panichi | e3280c177b | |
Giancarlo Panichi | b2da0eec05 | |
Giancarlo Panichi | 8f44e05c3e | |
Giancarlo Panichi | 31e70c462f | |
Giancarlo Panichi | b0ceadb96d | |
Giancarlo Panichi | 819711eee2 | |
Giancarlo Panichi | fbee16c8f0 | |
Giancarlo Panichi | d5ae696ed5 | |
Giancarlo Panichi | 3102594039 | |
Giancarlo Panichi | 86bb6c207f | |
Giancarlo Panichi | 01b71e2715 | |
Giancarlo Panichi | 561e81d244 | |
Giancarlo Panichi | 7a64b7c5be | |
Giancarlo Panichi | 8d02cd3e83 | |
Giancarlo Panichi | d95a4908ba | |
Giancarlo Panichi | 176b4281ed | |
Giancarlo Panichi | 2585b6142d | |
Giancarlo Panichi | 91caeb280b | |
Giancarlo Panichi | 69ee033316 | |
Giancarlo Panichi | c1921a3762 | |
Giancarlo Panichi | 5f1e4f9787 | |
Giancarlo Panichi | 7899ababdd | |
Giancarlo Panichi | d2c45d0c8b | |
Giancarlo Panichi | e093239c7b | |
Giancarlo Panichi | 9aed0df4a4 | |
Giancarlo Panichi | 1b7de34407 | |
Giancarlo Panichi | 62aa6ba5e1 | |
Giancarlo Panichi | e2060ff42d | |
Giancarlo Panichi | 6937be301c | |
Giancarlo Panichi | 69980a374a | |
Giancarlo Panichi | c48f391c87 | |
Giancarlo Panichi | 71f0926993 | |
Roberto Cirillo | 346e0b7748 | |
Roberto Cirillo | 2671a67ac1 | |
Roberto Cirillo | 4265ae8e70 | |
Roberto Cirillo | 1e49f1d35d | |
Giancarlo Panichi | cfdd266838 | |
Giancarlo Panichi | 52d41e889d | |
Giancarlo Panichi | b800556d6f | |
Giancarlo Panichi | 5cb240e97a | |
Giancarlo Panichi | 7bed8b59e9 | |
Giancarlo Panichi | e3c599d292 | |
Giancarlo Panichi | 9bd2519bbc | |
Giancarlo Panichi | e81d732ea1 | |
Giancarlo Panichi | cbea0b56f5 | |
Giancarlo Panichi | cba597494c | |
Roberto Cirillo | f513238cd0 | |
Roberto Cirillo | cc31ba1de2 | |
Roberto Cirillo | 2e57aeb630 | |
Roberto Cirillo | ac7e337f3e | |
lucio.lelii | bf3f8cd58c | |
lucio.lelii | a4dbd0fac2 | |
lucio.lelii | bdf0b492d5 | |
user1 | 95a92df6de | |
Giancarlo Panichi | 4bff1bd79d | |
Giancarlo Panichi | df38cb0c46 | |
Giancarlo Panichi | d1251c5b70 | |
Giancarlo Panichi | c05cce2f82 | |
Giancarlo Panichi | 0f583d0cc2 | |
Giancarlo Panichi | 7a4e80f891 | |
roberto cirillo | 3ab0201546 | |
roberto cirillo | 089733893e | |
roberto cirillo | ab13ee6e54 | |
roberto cirillo | 3a9957d3c5 | |
Giancarlo Panichi | 690126d6c0 | |
Giancarlo Panichi | 1dcab757f7 | |
Giancarlo Panichi | 45701f4941 | |
Giancarlo Panichi | bbec962117 | |
Giancarlo Panichi | 5cdf891f29 | |
Giancarlo Panichi | 56c5d7af14 | |
Giancarlo Panichi | 3d05e152ac | |
Giancarlo Panichi | 7f20c6a0b6 | |
Giancarlo Panichi | 0a6e67b98e | |
Giancarlo Panichi | 12370e08e5 | |
Giancarlo Panichi | d56e3ef04f | |
Giancarlo Panichi | fd6ea10bb9 | |
Giancarlo Panichi | ac9b4a19fe | |
Giancarlo Panichi | 215f1a3d21 | |
Giancarlo Panichi | 1b1117997e | |
Giancarlo Panichi | b1fcb7a96f | |
Giancarlo Panichi | 7c9bfbf4bb | |
Lucio Lelii | 281476cb0c | |
Lucio Lelii | b84c097408 | |
Lucio Lelii | 538db67938 | |
Lucio Lelii | f89709c5bd | |
Lucio Lelii | 2f72667a0c | |
Giancarlo Panichi | d634499e3c | |
Giancarlo Panichi | 1a4c956c34 | |
Giancarlo Panichi | 4e50405169 | |
Lucio Lelii | 703b6803ee | |
Giancarlo Panichi | 1b4b507cf2 | |
Lucio Lelii | 13693b56b4 | |
Lucio Lelii | 195c5e18a9 | |
Lucio Lelii | 053e90458f | |
Lucio Lelii | 2b2d42d120 | |
Lucio Lelii | bb05e9b652 | |
Lucio Lelii | 8447bd6fb5 | |
Lucio Lelii | 7cb8617529 | |
Lucio Lelii | 309f6ea62d | |
Lucio Lelii | a2f124a540 | |
Lucio Lelii | 6d3cab333f | |
Lucio Lelii | c829d56e4d |
16
CHANGELOG.md
16
CHANGELOG.md
|
@ -1,5 +1,18 @@
|
||||||
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
# Changelog for "dataminer"
|
# Changelog for "dataminer"
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.9.1]
|
||||||
|
|
||||||
|
- Updated gcube-bom to 2.4.1
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.9.0] - 2022-04-05
|
||||||
|
|
||||||
|
- Added support to new JWT token via URI Resolver [#23107]
|
||||||
|
|
||||||
|
|
||||||
## [v1.8.1] - 2022-03-21
|
## [v1.8.1] - 2022-03-21
|
||||||
|
|
||||||
- Update wps service to support not writing of the computation status to the user's workspace [#23054]
|
- Update wps service to support not writing of the computation status to the user's workspace [#23054]
|
||||||
|
@ -62,6 +75,3 @@
|
||||||
|
|
||||||
- First Release
|
- First Release
|
||||||
|
|
||||||
|
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
||||||
|
|
||||||
|
|
24
pom.xml
24
pom.xml
|
@ -1,15 +1,16 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>maven-parent</artifactId>
|
<artifactId>maven-parent</artifactId>
|
||||||
<groupId>org.gcube.tools</groupId>
|
<groupId>org.gcube.tools</groupId>
|
||||||
<version>1.1.0</version>
|
<version>1.2.0</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.gcube.dataanalysis</groupId>
|
<groupId>org.gcube.dataanalysis</groupId>
|
||||||
<artifactId>dataminer</artifactId>
|
<artifactId>dataminer</artifactId>
|
||||||
<version>1.8.1</version>
|
<version>1.9.1</version>
|
||||||
<name>dataminer</name>
|
<name>dataminer</name>
|
||||||
<description>An e-Infrastructure service providing state-of-the art DataMining algorithms and ecological modelling approaches under the Web Processing Service (WPS) standard.</description>
|
<description>An e-Infrastructure service providing state-of-the art DataMining algorithms and ecological modelling approaches under the Web Processing Service (WPS) standard.</description>
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
<developer>
|
<developer>
|
||||||
<name>Gianpaolo Coro</name>
|
<name>Gianpaolo 52n-wps-io-implCoro</name>
|
||||||
<email>gianpaolo.coro@isti.cnr.it</email>
|
<email>gianpaolo.coro@isti.cnr.it</email>
|
||||||
<organization>CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"</organization>
|
<organization>CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"</organization>
|
||||||
<roles>
|
<roles>
|
||||||
|
@ -55,7 +56,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>gcube-bom</artifactId>
|
<artifactId>gcube-bom</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.4.1</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -91,12 +92,12 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.dataanalysis</groupId>
|
<groupId>org.gcube.dataanalysis</groupId>
|
||||||
<artifactId>52n-wps-algorithm-gcube</artifactId>
|
<artifactId>52n-wps-algorithm-gcube</artifactId>
|
||||||
<version>[3.6.1,3.7.0)</version>
|
<version>[3.6.1,3.7.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.dataanalysis</groupId>
|
<groupId>org.gcube.dataanalysis</groupId>
|
||||||
<artifactId>52n-wps-server-gcube</artifactId>
|
<artifactId>52n-wps-server-gcube</artifactId>
|
||||||
<version>[3.6.1, 3.7.0)</version>
|
<version>[3.6.1, 3.7.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.dataanalysis</groupId>
|
<groupId>org.gcube.dataanalysis</groupId>
|
||||||
|
@ -106,7 +107,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.dataanalysis</groupId>
|
<groupId>org.gcube.dataanalysis</groupId>
|
||||||
<artifactId>ecological-engine-geospatial-extensions</artifactId>
|
<artifactId>ecological-engine-geospatial-extensions</artifactId>
|
||||||
<version>[1.5.2-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
<version>[1.5.2,2.0.0-SNAPSHOT)</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
|
@ -117,12 +118,12 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.dataanalysis</groupId>
|
<groupId>org.gcube.dataanalysis</groupId>
|
||||||
<artifactId>ecological-engine-external-algorithms</artifactId>
|
<artifactId>ecological-engine-external-algorithms</artifactId>
|
||||||
<version>[1.2.2-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
<version>[1.2.2,2.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.dataanalysis</groupId>
|
<groupId>org.gcube.dataanalysis</groupId>
|
||||||
<artifactId>ecological-engine-smart-executor</artifactId>
|
<artifactId>ecological-engine-smart-executor</artifactId>
|
||||||
<version>[1.6.5-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
<version>[1.6.5,2.0.0-SNAPSHOT)</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>org.glassfish.jersey.core</groupId>
|
<groupId>org.glassfish.jersey.core</groupId>
|
||||||
|
@ -145,6 +146,7 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
@ -199,7 +201,7 @@
|
||||||
<repository>
|
<repository>
|
||||||
<id>n52-releases</id>
|
<id>n52-releases</id>
|
||||||
<name>52n Releases</name>
|
<name>52n Releases</name>
|
||||||
<url>http://52north.org/maven/repo/releases</url>
|
<url>https://52north.org/maven/repo/releases</url>
|
||||||
<releases>
|
<releases>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</releases>
|
</releases>
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
package org.gcube.dataanalysis.wps.statisticalmanager.synchserver.is;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||||
|
import org.gcube.common.resources.gcore.ServiceEndpoint.Runtime;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
|
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||||
|
import org.gcube.resources.discovery.icclient.ICFactory;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
public class InformationSystemUtils {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(InformationSystemUtils.class);
|
||||||
|
private static final String URI_RESOLVER_SERVICE_CATEGORY = "Service";
|
||||||
|
private static final String URI_RESOLVER_SERVICE_NAME = "HTTP-URI-Resolver";
|
||||||
|
|
||||||
|
public static String retrieveUriResolverOat(String scope) throws Exception {
|
||||||
|
try {
|
||||||
|
LOGGER.info("Retrieve URI Resolver Oat Service Info");
|
||||||
|
|
||||||
|
if (scope == null || scope.length() == 0) {
|
||||||
|
String error="Invalid request scope: " + scope;
|
||||||
|
LOGGER.error(error);
|
||||||
|
throw new Exception(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
ScopeProvider.instance.set(scope);
|
||||||
|
|
||||||
|
SimpleQuery query = ICFactory.queryFor(ServiceEndpoint.class);
|
||||||
|
query.addCondition("$resource/Profile/Category/text() eq '" + URI_RESOLVER_SERVICE_CATEGORY + "'")
|
||||||
|
.addCondition("$resource/Profile/Name/text() eq '" + URI_RESOLVER_SERVICE_NAME + "'")
|
||||||
|
.setResult("$resource/Profile/RunTime");
|
||||||
|
DiscoveryClient<Runtime> client = ICFactory.clientFor(Runtime.class);
|
||||||
|
|
||||||
|
List<Runtime> runtimeList = client.submit(query);
|
||||||
|
String serviceAddress = null;
|
||||||
|
if (runtimeList != null && !runtimeList.isEmpty()) {
|
||||||
|
for (int i = 0; i < runtimeList.size(); i++) {
|
||||||
|
Runtime accessPoint = runtimeList.get(i);
|
||||||
|
if (accessPoint != null) {
|
||||||
|
StringBuilder sb=new StringBuilder();
|
||||||
|
sb.append("https://");
|
||||||
|
sb.append(accessPoint.hostedOn());
|
||||||
|
sb.append("/oat/get");
|
||||||
|
serviceAddress=sb.toString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String error="RuntimeList error: "+runtimeList;
|
||||||
|
LOGGER.error(error);
|
||||||
|
throw new Exception(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGGER.info("Uri Resolver Oat Service Info: " + serviceAddress);
|
||||||
|
return serviceAddress;
|
||||||
|
|
||||||
|
} catch (Throwable e) {
|
||||||
|
LOGGER.error("Error in discovery Uri Resolver Oat Service Endpoint in scope: " + scope);
|
||||||
|
LOGGER.error(e.getLocalizedMessage(),e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,30 +2,42 @@ package org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping;
|
||||||
|
|
||||||
import static org.gcube.common.authorization.client.Constants.authorizationService;
|
import static org.gcube.common.authorization.client.Constants.authorizationService;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import org.gcube.common.authorization.library.AuthorizationEntry;
|
import org.gcube.common.authorization.library.AuthorizationEntry;
|
||||||
|
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
|
||||||
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.is.InformationSystemUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class TokenManager {
|
public class TokenManager {
|
||||||
|
|
||||||
private static final Logger LOGGER= LoggerFactory.getLogger(TokenManager.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(TokenManager.class);
|
||||||
|
|
||||||
String username;
|
String username;
|
||||||
String scope;
|
String scope;
|
||||||
String token;
|
String token;
|
||||||
String tokenQualifier;
|
String tokenQualifier;
|
||||||
|
|
||||||
public String getScope(){
|
public String getScope() {
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserName(){
|
public String getUserName() {
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToken(){
|
public String getToken() {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,27 +46,78 @@ public class TokenManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getCredentials() {
|
public void getCredentials() {
|
||||||
try{
|
try {
|
||||||
LOGGER.debug("Retrieving token credentials");
|
LOGGER.info("Retrieving token credentials");
|
||||||
//get username from SmartGears
|
// get username from SmartGears
|
||||||
username = AuthorizationProvider.instance.get().getClient().getId();
|
username = AuthorizationProvider.instance.get().getClient().getId();
|
||||||
token = SecurityTokenProvider.instance.get();
|
token = SecurityTokenProvider.instance.get();
|
||||||
|
if (token == null || token.isEmpty()) {
|
||||||
|
String jwtToken = AccessTokenProvider.instance.get();
|
||||||
|
scope = ScopeProvider.instance.get();
|
||||||
|
token = getGcubeTokenFromUriResolver(jwtToken, scope);
|
||||||
|
}
|
||||||
AuthorizationEntry entry = authorizationService().get(token);
|
AuthorizationEntry entry = authorizationService().get(token);
|
||||||
scope = entry.getContext();
|
scope = entry.getContext();
|
||||||
tokenQualifier = entry.getQualifier();
|
tokenQualifier = entry.getQualifier();
|
||||||
|
} catch (Exception e) {
|
||||||
}catch(Exception e){
|
LOGGER.error("Error Retrieving token credentials: "+e.getLocalizedMessage(),e);
|
||||||
LOGGER.error("Error Retrieving token credentials ",e);
|
|
||||||
scope = null;
|
scope = null;
|
||||||
username= null;
|
username = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
if ((scope==null || username==null) && ConfigurationManager.isSimulationMode()){
|
if ((scope == null || username == null) && ConfigurationManager.isSimulationMode()) {
|
||||||
scope = ConfigurationManager.defaultScope;
|
scope = ConfigurationManager.defaultScope;
|
||||||
username = ConfigurationManager.defaultUsername;
|
username = ConfigurationManager.defaultUsername;
|
||||||
}
|
}
|
||||||
LOGGER.debug("Retrieved scope: {} Username: {} Token {} SIMULATION MODE: {} ",scope, username, token, ConfigurationManager.isSimulationMode());
|
LOGGER.info("Retrieved scope: {} Username: {} Token {} SIMULATION MODE: {} ", scope, username, token,
|
||||||
|
ConfigurationManager.isSimulationMode());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getGcubeTokenFromUriResolver(String jwtToken, String scope) throws Exception {
|
||||||
|
String gcubeToken = null;
|
||||||
|
String uriResolverOatURL = InformationSystemUtils.retrieveUriResolverOat(scope);
|
||||||
|
try {
|
||||||
|
LOGGER.info("Create Request: "+ uriResolverOatURL);
|
||||||
|
URL urlObj = new URL(uriResolverOatURL);
|
||||||
|
HttpURLConnection connection = (HttpURLConnection) urlObj.openConnection();
|
||||||
|
connection.setRequestMethod("GET");
|
||||||
|
connection.setRequestProperty("Authorization", "Bearer " + jwtToken);
|
||||||
|
connection.setDoOutput(true);
|
||||||
|
try (AutoCloseable conc = () -> connection.disconnect()) {
|
||||||
|
int responseCode = connection.getResponseCode();
|
||||||
|
LOGGER.info("Response Code: " + responseCode);
|
||||||
|
|
||||||
|
if (Response.Status.fromStatusCode(responseCode).compareTo(Response.Status.OK) == 0) {
|
||||||
|
try (InputStream ins = connection.getInputStream();
|
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(ins))) {
|
||||||
|
String inputLine = null;
|
||||||
|
while ((inputLine = in.readLine()) != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
gcubeToken = inputLine;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String error = "Invalid Response Code retrieving GCube Token from Uri Resolver: " + responseCode;
|
||||||
|
LOGGER.error(error);
|
||||||
|
try (InputStream ins = connection.getErrorStream();
|
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(ins))) {
|
||||||
|
String inputLine = null;
|
||||||
|
while ((inputLine = in.readLine()) != null) {
|
||||||
|
LOGGER.error(inputLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new Exception(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOGGER.error("Error retrieving GcubeToken from Uri Resolver: "+e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
LOGGER.info("Retrieved GcubeToken: "+gcubeToken);
|
||||||
|
return gcubeToken;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping;
|
||||||
|
|
||||||
|
import org.apache.log4j.BasicConfigurator;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class TokenManagerTest {
|
||||||
|
|
||||||
|
private static final String JWT_TOKEN = "";
|
||||||
|
private static final String SCOPE = "/gcube/devsec/devVRE";
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void retrieveTokenFromUriResolver() throws Exception {
|
||||||
|
try {
|
||||||
|
BasicConfigurator.configure();
|
||||||
|
System.out.println("Test Retrieve Token From Uri Resolver");
|
||||||
|
TokenManager tm = new TokenManager();
|
||||||
|
String token = tm.getGcubeTokenFromUriResolver(JWT_TOKEN, SCOPE);
|
||||||
|
System.out.println("GcubeToken retrieved: "+token);
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e.getLocalizedMessage());
|
||||||
|
e.getStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -30,7 +30,7 @@ public class AlgorithmTest {
|
||||||
|
|
||||||
String protocol = "http";
|
String protocol = "http";
|
||||||
String hostname = "dataminer-genericworkers.d4science.org";
|
String hostname = "dataminer-genericworkers.d4science.org";
|
||||||
String token = "257800d8-24bf-4bae-83cd-ea99369e7dd6-843339462";
|
String token = "xxx-xxx-xxx-xxx";
|
||||||
String layerID = "08ee0d70-4d8b-4f42-8b06-d709482bca95";
|
String layerID = "08ee0d70-4d8b-4f42-8b06-d709482bca95";
|
||||||
|
|
||||||
Iterator<String> uris = getUrisIterator();
|
Iterator<String> uris = getUrisIterator();
|
||||||
|
|
Loading…
Reference in New Issue