Dependencies Management

This commit is contained in:
Fabio Sinibaldi 2022-09-27 12:23:08 +02:00
parent a1c0913e41
commit 303b8a035e
5 changed files with 117 additions and 39 deletions

View File

@ -45,7 +45,6 @@
<groupId>net.postgis</groupId>
<artifactId>postgis-jdbc</artifactId>
<version>2.5.0</version>
<scope>provided</scope>
</dependency>
<!-- SDI -->
@ -53,7 +52,6 @@
<groupId>org.gcube.spatial.data</groupId>
<artifactId>gis-interface</artifactId>
<version>[2.4.6,3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
@ -62,7 +60,6 @@
<groupId>org.gcube.data.transfer</groupId>
<artifactId>data-transfer-library</artifactId>
<version>[1.2.1,2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@ -84,6 +84,31 @@
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-utils</artifactId>
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-authorization</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-encryption</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j18-impl</artifactId>

View File

@ -4,6 +4,10 @@ import lombok.extern.slf4j.Slf4j;
import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.authorization.utils.manager.SecretManager;
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
import org.gcube.common.authorization.utils.secret.GCubeSecret;
import org.gcube.common.authorization.utils.secret.Secret;
import org.gcube.common.scope.api.ScopeProvider;
import java.io.File;
@ -27,19 +31,27 @@ public class TokenSetter {
public static void set(String scope){
SecretManagerProvider.instance.set(new SecretManager());
if(!props.containsKey(scope)) throw new RuntimeException("No token found for scope : "+scope);
// Secret secret = SecretUtility. getSecretByTokenString(token); // se non sai con che token hai a che fare;
// oppure
String toSet= props.getProperty(scope);
log.debug("Setting secret "+toSet);
Secret secret = new GCubeSecret(toSet); // se vecchio token
// oppure
// Secret secret = new JWTSecret(token); // se nuovo token
SecretManagerProvider.instance.get().addSecret(secret);
try{
if(!props.containsKey(scope)) throw new RuntimeException("No token found for scope : "+scope);
SecurityTokenProvider.instance.set(props.getProperty(scope));
}catch(Throwable e){
log.warn("Unable to set token for scope "+scope,e);
}
ScopeProvider.instance.set(scope);
SecretManagerProvider.instance.get().set();
}catch(Exception e ){throw new RuntimeException("Unable to set secret for context "+scope,e);}
}
//
// public static void setUma() throws IOException {
// File umaFile = new File("uma.json");
// String uma= Files.readFileAsString(umaFile.getAbsolutePath(), Charset.defaultCharset());
// AccessTokenProvider.instance.set(uma);
//
// }
public static void setUma() throws IOException {
File umaFile = new File("uma.json");
String uma= Files.readFileAsString(umaFile.getAbsolutePath(), Charset.defaultCharset());
AccessTokenProvider.instance.set(uma);
}
}
}

View File

@ -72,7 +72,11 @@
<version>3.6.0</version>
</dependency>
<!-- IS Read -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<!-- STORAGE -->
<dependency>
@ -139,6 +143,24 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<scope>test</scope>
</dependency>
<!-- Plugins related tests -->
<dependency>
@ -153,7 +175,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.gcube.data.transfer</groupId>
<artifactId>data-transfer-library</artifactId>
@ -161,11 +182,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
</dependencies>
<build>

60
pom.xml
View File

@ -22,19 +22,19 @@
<gitBaseUrl>https://code-repo.d4science.org/gCubeSystem</gitBaseUrl>
<!-- prod -->
<!-- <gcube-bom-version>2.0.2</gcube-bom-version>-->
<!-- <gcube-smartgears-bom-version>2.1.1</gcube-smartgears-bom-version>-->
<!-- <gcube-portal-bom-version>3.6.3</gcube-portal-bom-version>-->
<!-- <storagehub-version-range>[1.0.0,2.0.0-SNAPSHOT)</storagehub-version-range>-->
<!-- <plugin-framework-version>1.0.1-SNAPSHOT</plugin-framework-version>-->
<gcube-bom-version>2.0.2</gcube-bom-version>
<gcube-smartgears-bom-version>2.1.1</gcube-smartgears-bom-version>
<gcube-portal-bom-version>3.6.3</gcube-portal-bom-version>
<storagehub-version-range>[1.0.0,2.0.0-SNAPSHOT)</storagehub-version-range>
<plugin-framework-version>1.0.1-SNAPSHOT</plugin-framework-version>
<!--dev -->
<gcube-bom-version>2.1.0-SNAPSHOT</gcube-bom-version>
<gcube-smartgears-bom-version>2.2.0-SNAPSHOT</gcube-smartgears-bom-version>
<gcube-portal-bom-version>3.7.0-SNAPSHOT</gcube-portal-bom-version>
<storagehub-version-range>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</storagehub-version-range>
<!-- <storagehub-version-range>[1.0.0,2.0.0-SNAPSHOT)</storagehub-version-range>-->
<plugin-framework-version>1.0.1-SNAPSHOT</plugin-framework-version>
<!-- <gcube-bom-version>2.1.0-SNAPSHOT</gcube-bom-version>-->
<!-- <gcube-smartgears-bom-version>2.2.0-SNAPSHOT</gcube-smartgears-bom-version>-->
<!-- <gcube-portal-bom-version>3.7.0-SNAPSHOT</gcube-portal-bom-version>-->
<!-- <storagehub-version-range>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</storagehub-version-range>-->
<!--&lt;!&ndash; <storagehub-version-range>[1.0.0,2.0.0-SNAPSHOT)</storagehub-version-range>&ndash;&gt;-->
<!-- <plugin-framework-version>1.0.1-SNAPSHOT</plugin-framework-version>-->
</properties>
@ -196,11 +196,39 @@
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
</dependency>
<!-- JDK 11 -->
<!-- NB versions introduced in gcube-bom 2.1.0 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>