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

View File

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

View File

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