This commit is contained in:
lucio 2023-02-08 16:29:28 +01:00
parent 96979e9289
commit bdc6998f6d
3 changed files with 13 additions and 21 deletions

14
pom.xml
View File

@ -7,24 +7,20 @@
<artifactId>maven-parent</artifactId> <artifactId>maven-parent</artifactId>
<version>1.1.0</version> <version>1.1.0</version>
</parent> </parent>
<groupId>org.gcube.accounting</groupId> <groupId>org.gcube.accounting</groupId>
<artifactId>accounting-lib</artifactId> <artifactId>accounting-lib</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>5.0.0-SNAPSHOT</version>
<name>Accounting Library</name> <name>Accounting Library</name>
<description>Accounting Library</description> <description>Accounting Library</description>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<serviceClass>Accounting</serviceClass> <serviceClass>Accounting</serviceClass>
</properties> </properties>
<scm> <scm>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection> <connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection> <developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>
<url>https://code-repo.d4science.org/gCubeSystem/${project.artifactId}</url> <url>https://code-repo.d4science.org/gCubeSystem/${project.artifactId}</url>
</scm> </scm>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
@ -36,12 +32,7 @@
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<dependencies> <dependencies>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.data.publishing</groupId> <groupId>org.gcube.data.publishing</groupId>
<artifactId>document-store-lib</artifactId> <artifactId>document-store-lib</artifactId>
@ -62,6 +53,11 @@
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>
<artifactId>gcube-jackson-databind</artifactId> <artifactId>gcube-jackson-databind</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.gcube.common.security</groupId>
<artifactId>gcube-secrets</artifactId>
<scope>test</scope>
</dependency>
<!-- Test Dependencies --> <!-- Test Dependencies -->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>

View File

@ -23,7 +23,7 @@ public class ValidTimeValidatorTest {
@Test @Test
public void testClassLong() throws InvalidValueException{ public void testClassLong() throws InvalidValueException{
ValidLongValidator validTimeValidator = new ValidLongValidator(); ValidLongValidator validTimeValidator = new ValidLongValidator();
Long myLong = new Long(4); Long myLong = 4l;
validTimeValidator.validate(null, myLong, null); validTimeValidator.validate(null, myLong, null);
} }

View File

@ -7,11 +7,9 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Properties; import java.util.Properties;
import org.gcube.common.authorization.client.Constants;
import org.gcube.common.authorization.client.exceptions.ObjectNotFound; import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
import org.gcube.common.authorization.library.AuthorizationEntry; import org.gcube.common.security.Owner;
import org.gcube.common.authorization.library.provider.ClientInfo; import org.gcube.common.security.secrets.GCubeSecret;
import org.gcube.common.authorization.library.utils.Caller;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -64,8 +62,8 @@ public class ContextTest {
} }
public static String getCurrentScope(String token) throws ObjectNotFound, Exception { public static String getCurrentScope(String token) throws ObjectNotFound, Exception {
AuthorizationEntry authorizationEntry = Constants.authorizationService().get(token); GCubeSecret secret = new GCubeSecret(token);
String context = authorizationEntry.getContext(); String context = secret.getContext();
logger.info("Context of token {} is {}", token, context); logger.info("Context of token {} is {}", token, context);
return context; return context;
} }
@ -76,11 +74,9 @@ public class ContextTest {
} }
private static void setContext(String token) throws ObjectNotFound, Exception { private static void setContext(String token) throws ObjectNotFound, Exception {
AuthorizationEntry authorizationEntry = Constants.authorizationService().get(token); GCubeSecret secret = new GCubeSecret(token);
ClientInfo clientInfo = authorizationEntry.getClientInfo(); Owner clientInfo = secret.getOwner();
logger.debug("User : {} - Type : {}", clientInfo.getId(), clientInfo.getType().name()); logger.debug("User : {} - external client? ok: {}", clientInfo.getId(), clientInfo.isExternalClient());
String qualifier = authorizationEntry.getQualifier();
Caller caller = new Caller(clientInfo, qualifier);
} }
@BeforeClass @BeforeClass