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

View File

@ -84,6 +84,31 @@
<artifactId>jackson-datatype-jsr310</artifactId> <artifactId>jackson-datatype-jsr310</artifactId>
</dependency> </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> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j18-impl</artifactId> <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.application.geoportal.common.utils.Files;
import org.gcube.common.authorization.library.provider.AccessTokenProvider; import org.gcube.common.authorization.library.provider.AccessTokenProvider;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider; 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 org.gcube.common.scope.api.ScopeProvider;
import java.io.File; import java.io.File;
@ -27,19 +31,27 @@ public class TokenSetter {
public static void set(String scope){ public static void set(String scope){
try{ SecretManagerProvider.instance.set(new SecretManager());
if(!props.containsKey(scope)) throw new RuntimeException("No token found for scope : "+scope); if(!props.containsKey(scope)) throw new RuntimeException("No token found for scope : "+scope);
SecurityTokenProvider.instance.set(props.getProperty(scope)); // Secret secret = SecretUtility. getSecretByTokenString(token); // se non sai con che token hai a che fare;
}catch(Throwable e){ // oppure
log.warn("Unable to set token for scope "+scope,e); String toSet= props.getProperty(scope);
} log.debug("Setting secret "+toSet);
ScopeProvider.instance.set(scope); Secret secret = new GCubeSecret(toSet); // se vecchio token
} // oppure
// Secret secret = new JWTSecret(token); // se nuovo token
public static void setUma() throws IOException {
File umaFile = new File("uma.json");
String uma= Files.readFileAsString(umaFile.getAbsolutePath(), Charset.defaultCharset());
AccessTokenProvider.instance.set(uma);
SecretManagerProvider.instance.get().addSecret(secret);
try{
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);
//
// }
} }

View File

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

50
pom.xml
View File

@ -22,19 +22,19 @@
<gitBaseUrl>https://code-repo.d4science.org/gCubeSystem</gitBaseUrl> <gitBaseUrl>https://code-repo.d4science.org/gCubeSystem</gitBaseUrl>
<!-- prod --> <!-- prod -->
<!-- <gcube-bom-version>2.0.2</gcube-bom-version>--> <gcube-bom-version>2.0.2</gcube-bom-version>
<!-- <gcube-smartgears-bom-version>2.1.1</gcube-smartgears-bom-version>--> <gcube-smartgears-bom-version>2.1.1</gcube-smartgears-bom-version>
<!-- <gcube-portal-bom-version>3.6.3</gcube-portal-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>--> <storagehub-version-range>[1.0.0,2.0.0-SNAPSHOT)</storagehub-version-range>
<!-- <plugin-framework-version>1.0.1-SNAPSHOT</plugin-framework-version>--> <plugin-framework-version>1.0.1-SNAPSHOT</plugin-framework-version>
<!--dev --> <!--dev -->
<gcube-bom-version>2.1.0-SNAPSHOT</gcube-bom-version> <!-- <gcube-bom-version>2.1.0-SNAPSHOT</gcube-bom-version>-->
<gcube-smartgears-bom-version>2.2.0-SNAPSHOT</gcube-smartgears-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> <!-- <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>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</storagehub-version-range>-->
<!-- <storagehub-version-range>[1.0.0,2.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> <!-- <plugin-framework-version>1.0.1-SNAPSHOT</plugin-framework-version>-->
</properties> </properties>
@ -196,12 +196,40 @@
</dependency> </dependency>
<!-- JDK 11 -->
<!-- NB versions introduced in gcube-bom 2.1.0 -->
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<version>1.18.4</version> <version>1.18.4</version>
</dependency> </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> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>