Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #401: Remove Guava dependency #402

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,26 +177,19 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${maven-enforcer-plugin.version}</version>
<dependencies>
<dependency>
<groupId>de.skuzzle.enforcer</groupId>
<artifactId>restrict-imports-enforcer-rule</artifactId>
<version>2.4.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>enforce-banned-java-imports</id>
<id>enforce-banned-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<RestrictImports>
<!-- https://github.com/google/guava/issues/2960 -->
<reason>Guava depends on jsr305 but we prefer jakarta in our code</reason>
<bannedImport>javax.annotation.**</bannedImport>
</RestrictImports>
<bannedDependencies>
<excludes>
<exclude>com.google.guava:guava*:*:*:compile</exclude>
banterCZ marked this conversation as resolved.
Show resolved Hide resolved
</excludes>
</bannedDependencies>
</rules>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
*/
package io.getlime.security.powerauth.lib.cmd.consts;

import com.google.common.collect.ImmutableList;

import java.util.Arrays;
import java.util.List;

/**
* PowerAuth protocol version enumeration
Expand All @@ -45,7 +44,7 @@ public enum PowerAuthVersion {
/**
* All supported versions
*/
public static final ImmutableList<PowerAuthVersion> ALL_VERSIONS = ImmutableList.copyOf(values());
public static final List<PowerAuthVersion> ALL_VERSIONS = List.of(values());

/**
* Default version
Expand All @@ -55,7 +54,7 @@ public enum PowerAuthVersion {
/**
* All versions belonging to major version 3
*/
public static final ImmutableList<PowerAuthVersion> VERSION_3 = ImmutableList.of(V3_0, V3_1, V3_2);
public static final List<PowerAuthVersion> VERSION_3 = List.of(V3_0, V3_1, V3_2);

/**
* Major version value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package io.getlime.security.powerauth.lib.cmd.steps;

import com.google.common.collect.ImmutableList;
import com.wultra.core.rest.client.base.RestClient;
import com.wultra.core.rest.client.base.RestClientException;
import io.getlime.security.powerauth.crypto.lib.encryptor.ClientEncryptor;
Expand All @@ -27,8 +26,6 @@
import io.getlime.security.powerauth.crypto.lib.encryptor.model.EncryptorId;
import io.getlime.security.powerauth.crypto.lib.encryptor.model.EncryptorParameters;
import io.getlime.security.powerauth.crypto.lib.encryptor.model.v3.ClientEncryptorSecrets;
import io.getlime.security.powerauth.crypto.lib.generator.KeyGenerator;
import io.getlime.security.powerauth.crypto.lib.util.KeyConvertor;
import io.getlime.security.powerauth.lib.cmd.consts.PowerAuthStep;
import io.getlime.security.powerauth.lib.cmd.consts.PowerAuthVersion;
import io.getlime.security.powerauth.lib.cmd.logging.DisabledStepLogger;
Expand Down Expand Up @@ -80,7 +77,7 @@ public abstract class AbstractBaseStep<M extends BaseStepData, R> implements Bas
* Supported versions of PowerAuth by this step
*/
@Getter
private final ImmutableList<PowerAuthVersion> supportedVersions;
private final List<PowerAuthVersion> supportedVersions;

/**
* Result status service
Expand All @@ -93,8 +90,6 @@ public abstract class AbstractBaseStep<M extends BaseStepData, R> implements Bas
protected final StepLoggerFactory stepLoggerFactory;

private static final EncryptorFactory ENCRYPTOR_FACTORY = new EncryptorFactory();
private static final KeyGenerator KEY_GENERATOR = new KeyGenerator();
private static final KeyConvertor KEY_CONVERTOR = new KeyConvertor();

/**
* Constructor
Expand All @@ -109,7 +104,7 @@ public AbstractBaseStep(PowerAuthStep step,
ResultStatusService resultStatusService,
StepLoggerFactory stepLoggerFactory) {
this.step = step;
this.supportedVersions = ImmutableList.copyOf(supportedVersions);
this.supportedVersions = List.copyOf(supportedVersions);

this.resultStatusService = resultStatusService;
this.stepLoggerFactory = stepLoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package io.getlime.security.powerauth.lib.cmd.steps.v3;

import com.google.common.collect.ImmutableMap;
import io.getlime.security.powerauth.crypto.lib.encryptor.model.EncryptorId;
import io.getlime.security.powerauth.lib.cmd.consts.BackwardCompatibilityConst;
import io.getlime.security.powerauth.lib.cmd.consts.PowerAuthConst;
Expand Down Expand Up @@ -119,11 +118,8 @@ public void processResponse(StepContext<CreateTokenStepModel, EciesEncryptedResp
"Token successfully obtained",
"Token was successfully generated and decrypted",
"OK",
ImmutableMap.<String, Object>builder()
.put("tokenId", tokenResponsePayload.getTokenId())
.put("tokenSecret", tokenResponsePayload.getTokenSecret())
.build()

Map.of("tokenId", tokenResponsePayload.getTokenId(),
"tokenSecret",tokenResponsePayload.getTokenSecret())
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package io.getlime.security.powerauth.lib.cmd.steps.v3;

import com.google.common.collect.ImmutableMap;
import io.getlime.security.powerauth.crypto.lib.encryptor.model.EncryptorId;
import io.getlime.security.powerauth.lib.cmd.consts.BackwardCompatibilityConst;
import io.getlime.security.powerauth.lib.cmd.consts.PowerAuthConst;
Expand Down Expand Up @@ -119,7 +118,7 @@ public void processResponse(StepContext<StartUpgradeStepModel, EciesEncryptedRes
"Upgrade start step successfully completed",
"Upgrade start step was successfully completed",
"OK",
ImmutableMap.of("ctrData", responsePayload.getCtrData())
Map.of("ctrData", responsePayload.getCtrData())
);
}

Expand Down