diff --git a/README.md b/README.md
index 1a877891..54c0d070 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
![LowkeyVault](.github/assets/LowkeyVault-logo-full.png)
[![GitHub license](https://img.shields.io/github/license/nagyesta/lowkey-vault?color=informational)](https://raw.githubusercontent.com/nagyesta/lowkey-vault/main/LICENSE)
-[![Java version](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)
+[![Java version](https://img.shields.io/badge/Java%20version-17%20app|11%20libs-yellow?logo=java)](https://img.shields.io/badge/Java%20version-17%20app|11%20libs-yellow?logo=java)
[![latest-release](https://img.shields.io/github/v/tag/nagyesta/lowkey-vault?color=blue&logo=git&label=releases&sort=semver)](https://github.com/nagyesta/lowkey-vault/releases)
[![Maven Central](https://img.shields.io/maven-central/v/com.github.nagyesta.lowkey-vault/lowkey-vault-app?logo=apache-maven)](https://search.maven.org/search?q=com.github.nagyesta.lowkey-vault)
[![Docker Hub](https://img.shields.io/docker/v/nagyesta/lowkey-vault?label=docker%20hub&logo=docker&sort=semver)](https://hub.docker.com/r/nagyesta/lowkey-vault)
diff --git a/build.gradle b/build.gradle
index 470a46e1..b44c2356 100644
--- a/build.gradle
+++ b/build.gradle
@@ -74,14 +74,7 @@ configure(subprojects.findAll({
mavenCentral()
}
- java {
- sourceCompatibility = JavaVersion.VERSION_11
- toolchain {
- languageVersion = JavaLanguageVersion.of(11)
- }
- withJavadocJar()
- withSourcesJar()
- }
+ javadoc.options.addStringOption('Xdoclint:none', '-quiet')
jacocoTestReport {
reports {
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index e8027f2a..17dd5e32 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,11 +1,11 @@
[versions]
-springBoot = "2.7.14"
-spring = "5.3.29"
+springBoot = "3.1.2"
+spring = "6.0.11"
snakeYaml = "2.1"
-tomcat = "9.0.79"
-logback = "1.2.12"
+tomcat = "10.1.12"
+logback = "1.4.11"
bouncycastle = "1.76"
-hibernateValidator = "6.2.5.Final"
+hibernateValidator = "8.0.1.Final"
findbugs = "3.0.2"
lombok = "1.18.28"
handlebars="4.3.1"
@@ -85,7 +85,7 @@ abort-mission-cucumber = { module = "com.github.nagyesta.abort-mission.boosters:
cucumber-java = { module = "io.cucumber:cucumber-java", version.ref = "cucumber" }
cucumber-testng = { module = "io.cucumber:cucumber-testng", version.ref = "cucumber" }
-cucumber-spring = { module = "io.cucumber:cucumber-spring", version.ref = "cucumber" }
+cucumber-picocontainer = { module = "io.cucumber:cucumber-picocontainer", version.ref = "cucumber" }
jackson-bom = { module = "com.fasterxml.jackson:jackson-bom", version.ref = "jacksonBom" }
jackson-core = { module = "com.fasterxml.jackson.core:jackson-core", version.ref = "jackson" }
@@ -104,7 +104,7 @@ spring-boot-app = [
]
spring-test = ["spring-boot-starter-test", "spring-test", "snake-yaml"]
logback = ["logback-classic", "logback-core"]
-cucumber = ["cucumber-java", "cucumber-testng", "cucumber-spring"]
+cucumber = ["cucumber-java", "cucumber-testng", "cucumber-picocontainer"]
jackson = ["jackson-core", "jackson-annotations", "jackson-databind", "jackson-dataformat-xml", "jackson-datatype-jsr310"]
tomcat = [
"tomcat-annotations-api", "tomcat-jsp-api", "tomcat-embed-core", "tomcat-embed-el", "tomcat-embed-jasper", "tomcat-embed-websocket"
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 90d22ac5..d1c2b467 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -18,12 +18,12 @@
-
-
-
+
+
+
-
-
+
+
@@ -34,12 +34,12 @@
-
-
-
+
+
+
-
-
+
+
@@ -47,9 +47,9 @@
-
-
-
+
+
+
@@ -184,11 +184,6 @@
-
-
-
-
-
@@ -262,11 +257,6 @@
-
-
-
-
-
@@ -277,11 +267,6 @@
-
-
-
-
-
@@ -292,11 +277,6 @@
-
-
-
-
-
@@ -307,11 +287,6 @@
-
-
-
-
-
@@ -322,19 +297,14 @@
-
-
-
-
-
-
-
-
+
+
+
@@ -342,11 +312,6 @@
-
-
-
-
-
@@ -367,9 +332,9 @@
-
-
-
+
+
+
@@ -382,11 +347,6 @@
-
-
-
-
-
@@ -722,12 +682,9 @@
-
-
-
-
-
-
+
+
+
@@ -821,11 +778,6 @@
-
-
-
-
-
@@ -1056,6 +1008,14 @@
+
+
+
+
+
+
+
+
@@ -1064,14 +1024,6 @@
-
-
-
-
-
-
-
-
@@ -1146,6 +1098,11 @@
+
+
+
+
+
@@ -1161,6 +1118,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1264,33 +1242,38 @@
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
-
-
+
+
+
+
-
-
-
+
+
+
-
-
+
+
@@ -1301,12 +1284,12 @@
-
-
-
+
+
+
-
-
+
+
@@ -1314,9 +1297,9 @@
-
-
-
+
+
+
@@ -1372,12 +1355,17 @@
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
@@ -1388,12 +1376,12 @@
-
-
-
+
+
+
-
-
+
+
@@ -1404,9 +1392,14 @@
-
-
-
+
+
+
+
+
+
+
+
@@ -1461,20 +1454,20 @@
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
@@ -1871,17 +1864,22 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
+
+
+
+
+
@@ -1889,12 +1887,17 @@
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
@@ -2025,68 +2028,68 @@
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
@@ -2125,17 +2128,22 @@
-
-
-
+
+
+
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
@@ -2193,6 +2201,11 @@
+
+
+
+
+
@@ -2201,6 +2214,11 @@
+
+
+
+
+
@@ -2287,12 +2305,22 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
@@ -2373,27 +2401,27 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -2451,27 +2479,27 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
+
+
@@ -2549,11 +2577,6 @@
-
-
-
-
-
@@ -2589,61 +2612,31 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -2654,17 +2647,22 @@
+
+
+
+
+
-
-
-
+
+
+
-
-
+
+
@@ -2675,20 +2673,12 @@
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
@@ -2699,24 +2689,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -2732,14 +2709,6 @@
-
-
-
-
-
-
-
-
@@ -2748,6 +2717,14 @@
+
+
+
+
+
+
+
+
@@ -2819,6 +2796,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2875,12 +2865,12 @@
-
-
-
+
+
+
-
-
+
+
@@ -2898,11 +2888,6 @@
-
-
-
-
-
@@ -2911,6 +2896,14 @@
+
+
+
+
+
+
+
+
@@ -2926,16 +2919,16 @@
-
-
-
-
-
+
+
+
+
+
@@ -3105,19 +3098,19 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -3125,9 +3118,19 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3140,19 +3143,24 @@
-
-
-
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -3160,14 +3168,14 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -3175,9 +3183,9 @@
-
-
-
+
+
+
@@ -3195,19 +3203,19 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -3215,34 +3223,34 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
diff --git a/lowkey-vault-app/README.md b/lowkey-vault-app/README.md
index f7d34596..4a60bd5e 100644
--- a/lowkey-vault-app/README.md
+++ b/lowkey-vault-app/README.md
@@ -1,7 +1,7 @@
![LowkeyVault](../.github/assets/LowkeyVault-logo-full.png)
[![GitHub license](https://img.shields.io/github/license/nagyesta/lowkey-vault?color=informational)](https://raw.githubusercontent.com/nagyesta/lowkey-vault/main/LICENSE)
-[![Java version](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)
+[![Java version](https://img.shields.io/badge/Java%20version-17-yellow?logo=java)](https://img.shields.io/badge/Java%20version-17-yellow?logo=java)
[![latest-release](https://img.shields.io/github/v/tag/nagyesta/lowkey-vault?color=blue&logo=git&label=releases&sort=semver)](https://github.com/nagyesta/lowkey-vault/releases)
[![Docker Hub](https://img.shields.io/docker/v/nagyesta/lowkey-vault?label=docker%20hub&logo=docker&sort=semver)](https://hub.docker.com/r/nagyesta/lowkey-vault)
[![JavaCI](https://img.shields.io/github/actions/workflow/status/nagyesta/lowkey-vault/gradle.yml?logo=github&branch=main)](https://github.com/nagyesta/lowkey-vault/actions/workflows/gradle.yml)
@@ -71,7 +71,7 @@ argument.
2. ```hostname:port``` (e.g. ```localhost:8443```)
meaning, that we want to register an alias to exactly that host and port, which is defined
3. ```hostname:``` (e.g. ```localhost:```)
- meaning that we want to register an alias to the the host defined in the ```hostname``` using the port set with
+ meaning that we want to register an alias to the host defined in the ```hostname``` using the port set with
```--server.port```
```shell
diff --git a/lowkey-vault-app/build.gradle b/lowkey-vault-app/build.gradle
index 271c5ee3..54047f2e 100644
--- a/lowkey-vault-app/build.gradle
+++ b/lowkey-vault-app/build.gradle
@@ -28,6 +28,15 @@ dependencies {
testImplementation libs.abort.mission.jupiter
}
+java {
+ sourceCompatibility = JavaVersion.VERSION_17
+ toolchain {
+ languageVersion = JavaLanguageVersion.of(17)
+ }
+ withJavadocJar()
+ withSourcesJar()
+}
+
test {
outputs.file(file("$buildDir/reports/abort-mission/abort-mission-report.json"))
useJUnitPlatform()
@@ -36,6 +45,7 @@ test {
systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent")
systemProperty("junit.jupiter.execution.parallel.mode.classes.default", "concurrent")
}
+
abortMission {
toolVersion libs.versions.abortMission.get()
}
@@ -50,11 +60,12 @@ processResources {
jar {
enabled = false
}
+
bootJar {
archiveVersion.value(project.version as String)
}
-task regenerateCertJks(type: Exec) {
+tasks.register('regenerateCertJks', Exec) {
outputs.file("${project.projectDir}/src/main/resources/cert/keystore.jks")
workingDir file("${project.projectDir}/src/main/resources/cert")
outputs.upToDateWhen { false }
@@ -80,7 +91,7 @@ task regenerateCertJks(type: Exec) {
logging.captureStandardOutput LogLevel.INFO
logging.captureStandardError LogLevel.ERROR
}
-task regenerateCert(type: Exec) {
+tasks.register('regenerateCert', Exec) {
outputs.file("${project.projectDir}/src/main/resources/cert/keystore.p12")
outputs.file("${project.projectDir}/src/main/resources/cert/keystore.jks")
inputs.file("${project.projectDir}/src/main/resources/cert/keystore.jks")
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/context/CertificateConverterConfiguration.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/context/CertificateConverterConfiguration.java
index b4bed50e..cefe3018 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/context/CertificateConverterConfiguration.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/context/CertificateConverterConfiguration.java
@@ -3,7 +3,6 @@
import com.github.nagyesta.lowkeyvault.mapper.common.registry.CertificateConverterRegistry;
import com.github.nagyesta.lowkeyvault.mapper.v7_3.certificate.*;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
@@ -11,8 +10,11 @@
@Configuration
public class CertificateConverterConfiguration {
- @Autowired
- private VaultService vaultService;
+ private final VaultService vaultService;
+
+ public CertificateConverterConfiguration(final VaultService vaultService) {
+ this.vaultService = vaultService;
+ }
@Bean
public CertificateConverterRegistry certificateConverterRegistry() {
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/PingController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/PingController.java
index f34e1a43..08f5fa30 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/PingController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/PingController.java
@@ -7,7 +7,7 @@
@RestController
public class PingController {
- @GetMapping("/ping")
+ @GetMapping(value = {"/ping", "/ping/"})
public ResponseEntity ping() {
return ResponseEntity.ok("pong");
}
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/VaultBackupManagementController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/VaultBackupManagementController.java
index 3ef52fb2..b94399b0 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/VaultBackupManagementController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/VaultBackupManagementController.java
@@ -46,9 +46,7 @@ public VaultBackupManagementController(@NonNull final VaultImporter vaultImporte
@Override
public void afterPropertiesSet() {
- vaultImporter.getVaults().forEach((baseUri, vault) -> {
- vaultImportExportExecutor.restoreVault(vaultImporter, baseUri, vault);
- });
+ vaultImporter.getVaults().forEach((baseUri, vault) -> vaultImportExportExecutor.restoreVault(vaultImporter, baseUri, vault));
}
@Operation(
@@ -64,7 +62,7 @@ public void afterPropertiesSet() {
schema = @Schema(implementation = ErrorModel.class)
))},
requestBody = @RequestBody(content = @Content(mediaType = MimeTypeUtils.APPLICATION_JSON_VALUE)))
- @GetMapping("/export")
+ @GetMapping(value = {"/export", "/export/"})
public ResponseEntity export() {
log.info("Received request to export active vaults.");
final List backupModels = vaultImportExportExecutor.backupVaultList(vaultService);
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/VaultManagementController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/VaultManagementController.java
index 96b33478..628a9c77 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/VaultManagementController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/VaultManagementController.java
@@ -12,16 +12,15 @@
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import jakarta.validation.Valid;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
import java.net.URI;
import java.util.List;
-import java.util.stream.Collectors;
import static com.github.nagyesta.lowkeyvault.openapi.Examples.*;
import static org.springframework.util.MimeTypeUtils.APPLICATION_JSON_VALUE;
@@ -57,7 +56,7 @@ public VaultManagementController(@NonNull final VaultService vaultService,
content = @Content(mediaType = APPLICATION_JSON_VALUE, schema = @Schema(implementation = ErrorModel.class)))},
requestBody = @RequestBody(
content = @Content(mediaType = APPLICATION_JSON_VALUE, schema = @Schema(implementation = VaultModel.class))))
- @PostMapping
+ @PostMapping(value = {"", "/"})
public ResponseEntity createVault(@Valid @org.springframework.web.bind.annotation.RequestBody final VaultModel model) {
log.info("Received request to create vault with uri: {}, recovery level: {}, recoverable days: {}",
model.getBaseUri(), model.getRecoveryLevel(), model.getRecoverableDays());
@@ -75,12 +74,12 @@ public ResponseEntity createVault(@Valid @org.springframework.web.bi
@ApiResponse(responseCode = "500", description = "Internal error",
content = @Content(mediaType = APPLICATION_JSON_VALUE, schema = @Schema(implementation = ErrorModel.class)))},
requestBody = @RequestBody(content = @Content(mediaType = APPLICATION_JSON_VALUE)))
- @GetMapping
+ @GetMapping(value = {"", "/"})
public ResponseEntity> listVaults() {
log.info("Received request to list vaults.");
final List vaultFake = vaultService.list().stream()
.map(vaultFakeToVaultModelConverter::convertNonNull)
- .collect(Collectors.toUnmodifiableList());
+ .toList();
log.info("Returning {} vaults.", vaultFake.size());
return ResponseEntity.ok(vaultFake);
}
@@ -94,12 +93,12 @@ public ResponseEntity> listVaults() {
@ApiResponse(responseCode = "500", description = "Internal error",
content = @Content(mediaType = APPLICATION_JSON_VALUE, schema = @Schema(implementation = ErrorModel.class)))},
requestBody = @RequestBody(content = @Content(mediaType = APPLICATION_JSON_VALUE)))
- @GetMapping("/deleted")
+ @GetMapping(value = {"/deleted", "/deleted/"})
public ResponseEntity> listDeletedVaults() {
log.info("Received request to list deleted vaults.");
final List vaultFake = vaultService.listDeleted().stream()
.map(vaultFakeToVaultModelConverter::convertNonNull)
- .collect(Collectors.toUnmodifiableList());
+ .toList();
log.info("Returning {} vaults.", vaultFake.size());
return ResponseEntity.ok(vaultFake);
}
@@ -117,9 +116,10 @@ public ResponseEntity> listDeletedVaults() {
@ApiResponse(responseCode = "500", description = "Internal error",
content = @Content(mediaType = APPLICATION_JSON_VALUE, schema = @Schema(implementation = ErrorModel.class)))},
parameters = {
- @Parameter(name = "baseUri", example = BASE_URI, description = "The base URI of the vault we want delete.")},
+ @Parameter(name = "baseUri",
+ example = BASE_URI, description = "The base URI of the vault we want delete.", required = true)},
requestBody = @RequestBody(content = @Content(mediaType = APPLICATION_JSON_VALUE)))
- @DeleteMapping
+ @DeleteMapping(value = {"", "/"})
public ResponseEntity deleteVault(@RequestParam final URI baseUri) {
log.info("Received request to delete vault with uri: {}", baseUri);
return ResponseEntity.ok(vaultService.delete(baseUri));
@@ -137,9 +137,10 @@ public ResponseEntity deleteVault(@RequestParam final URI baseUri) {
@ApiResponse(responseCode = "500", description = "Internal error",
content = @Content(mediaType = APPLICATION_JSON_VALUE, schema = @Schema(implementation = ErrorModel.class)))},
parameters = {
- @Parameter(name = "baseUri", example = BASE_URI, description = "The base URI of the vault we want to recover.")},
+ @Parameter(name = "baseUri",
+ example = BASE_URI, description = "The base URI of the vault we want to recover.", required = true)},
requestBody = @RequestBody(content = @Content(mediaType = APPLICATION_JSON_VALUE)))
- @PutMapping("/recover")
+ @PutMapping(value = {"/recover", "/recover/"})
public ResponseEntity recoverVault(@RequestParam final URI baseUri) {
log.info("Received request to recover deleted vault with uri: {}", baseUri);
vaultService.recover(baseUri);
@@ -160,9 +161,10 @@ public ResponseEntity recoverVault(@RequestParam final URI baseUri)
@ApiResponse(responseCode = "500", description = "Internal error",
content = @Content(mediaType = APPLICATION_JSON_VALUE, schema = @Schema(implementation = ErrorModel.class)))},
parameters = {
- @Parameter(name = "baseUri", example = BASE_URI, description = "The base URI of the vault we want to purge.")},
+ @Parameter(name = "baseUri",
+ example = BASE_URI, description = "The base URI of the vault we want to purge.", required = true)},
requestBody = @RequestBody(content = @Content(mediaType = APPLICATION_JSON_VALUE)))
- @DeleteMapping("/purge")
+ @DeleteMapping(value = {"/purge", "/purge/"})
public ResponseEntity purgeVault(@RequestParam final URI baseUri) {
log.info("Received request to purge deleted vault with uri: {}", baseUri);
return ResponseEntity.ok(vaultService.purge(baseUri));
@@ -181,13 +183,13 @@ public ResponseEntity purgeVault(@RequestParam final URI baseUri) {
content = @Content(mediaType = APPLICATION_JSON_VALUE, schema = @Schema(implementation = ErrorModel.class)))},
parameters = {
@Parameter(name = "baseUri", example = BASE_URI,
- description = "The base URI of the vault we want to update."),
+ description = "The base URI of the vault we want to update.", required = true),
@Parameter(name = "add", example = ALIAS1,
- description = "The base URI we want to add to the aliases of the vault.", required = false),
+ description = "The base URI we want to add to the aliases of the vault."),
@Parameter(name = "remove", example = ALIAS2,
- description = "The base URI we want to remove from the aliases of the vault.", required = false)},
+ description = "The base URI we want to remove from the aliases of the vault.")},
requestBody = @RequestBody(content = @Content(mediaType = APPLICATION_JSON_VALUE)))
- @PatchMapping("/alias")
+ @PatchMapping(value = {"/alias", "/alias/"})
public ResponseEntity aliasUpdate(@RequestParam final URI baseUri,
@RequestParam(required = false) final URI add,
@RequestParam(required = false) final URI remove) {
@@ -206,11 +208,11 @@ public ResponseEntity aliasUpdate(@RequestParam final URI baseUri,
@ApiResponse(responseCode = "500", description = "Internal error",
content = @Content(mediaType = APPLICATION_JSON_VALUE, schema = @Schema(implementation = ErrorModel.class)))},
parameters = {
- @Parameter(name = "seconds", example = ONE, description = "The number of seconds we want to shift."),
+ @Parameter(name = "seconds", example = ONE, description = "The number of seconds we want to shift.", required = true),
@Parameter(name = "regenerateCertificates", example = FALSE,
description = "Whether we allow regeneration of certificates to let their validity match the new time-frame.")},
requestBody = @RequestBody(content = @Content(mediaType = APPLICATION_JSON_VALUE)))
- @PutMapping(value = "/time/all", params = {"seconds"})
+ @PutMapping(value = {"/time/all", "/time/all/"}, params = {"seconds"})
public ResponseEntity timeShiftAll(
@RequestParam final int seconds,
@RequestParam(required = false, defaultValue = "false") final boolean regenerateCertificates) {
@@ -232,12 +234,13 @@ public ResponseEntity timeShiftAll(
@ApiResponse(responseCode = "500", description = "Internal error",
content = @Content(mediaType = APPLICATION_JSON_VALUE, schema = @Schema(implementation = ErrorModel.class)))},
parameters = {
- @Parameter(name = "seconds", example = ONE, description = "The number of seconds we want to shift."),
- @Parameter(name = "baseUri", example = BASE_URI, description = "The base URI of the vault we want to shift."),
+ @Parameter(name = "seconds", example = ONE, description = "The number of seconds we want to shift.", required = true),
+ @Parameter(name = "baseUri",
+ example = BASE_URI, description = "The base URI of the vault we want to shift.", required = true),
@Parameter(name = "regenerateCertificates", example = FALSE,
description = "Whether we allow regeneration of certificates to let their validity match the new time-frame.")},
requestBody = @RequestBody(content = @Content(mediaType = APPLICATION_JSON_VALUE)))
- @PutMapping(value = "/time", params = {"baseUri", "seconds"})
+ @PutMapping(value = {"/time", "/time/" }, params = {"baseUri", "seconds"})
public ResponseEntity timeShiftSingle(
@RequestParam final URI baseUri, @RequestParam final int seconds,
@RequestParam(required = false, defaultValue = "false") final boolean regenerateCertificates) {
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/BaseBackupRestoreController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/BaseBackupRestoreController.java
index dcc595ac..16455570 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/BaseBackupRestoreController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/BaseBackupRestoreController.java
@@ -19,7 +19,6 @@
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
-import java.util.stream.Collectors;
/**
* The base implementation of the backup/restore controllers.
@@ -79,7 +78,7 @@ protected B backupEntity(final K entityId) {
final List list = entities.getVersions(entityId).stream()
.map(version -> getEntityByNameAndVersion(entityId.vault(), entityId.id(), version))
.map(registry().backupConverter(apiVersion())::convert)
- .collect(Collectors.toUnmodifiableList());
+ .toList();
return wrapBackup(list);
}
@@ -91,7 +90,7 @@ protected String getSingleEntityName(final B backupModel) {
final List entityNames = backupModel.getValue().getVersions().stream()
.map(BLI::getId)
.distinct()
- .collect(Collectors.toUnmodifiableList());
+ .toList();
Assert.isTrue(entityNames.size() == 1, "All backup entities must belong to the same entity.");
return entityNames.get(0);
}
@@ -100,7 +99,7 @@ protected URI getSingleBaseUri(final B backupModel) {
final List uris = backupModel.getValue().getVersions().stream()
.map(BLI::getVaultBaseUri)
.distinct()
- .collect(Collectors.toUnmodifiableList());
+ .toList();
Assert.isTrue(uris.size() == 1, "All backup entities must be from the same vault.");
return uris.get(0);
}
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonCertificateBackupRestoreController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonCertificateBackupRestoreController.java
index d04b5969..92471113 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonCertificateBackupRestoreController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonCertificateBackupRestoreController.java
@@ -18,12 +18,12 @@
import com.github.nagyesta.lowkeyvault.service.certificate.impl.DefaultCertificateLifetimeActionPolicy;
import com.github.nagyesta.lowkeyvault.service.vault.VaultFake;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.lang.NonNull;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import java.util.List;
import java.util.Objects;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonCertificateController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonCertificateController.java
index 550ee58f..39dea386 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonCertificateController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonCertificateController.java
@@ -8,13 +8,13 @@
import com.github.nagyesta.lowkeyvault.service.certificate.id.CertificateEntityId;
import com.github.nagyesta.lowkeyvault.service.certificate.id.VersionedCertificateEntityId;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.lang.NonNull;
import org.springframework.web.bind.annotation.RequestBody;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import java.util.Map;
import java.util.Optional;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonCertificatePolicyController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonCertificatePolicyController.java
index 2135ad25..04bbc211 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonCertificatePolicyController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonCertificatePolicyController.java
@@ -8,12 +8,12 @@
import com.github.nagyesta.lowkeyvault.service.certificate.ReadOnlyKeyVaultCertificateEntity;
import com.github.nagyesta.lowkeyvault.service.certificate.id.VersionedCertificateEntityId;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.lang.NonNull;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import java.util.Objects;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonKeyBackupRestoreController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonKeyBackupRestoreController.java
index 6637dbef..b8b6ad76 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonKeyBackupRestoreController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonKeyBackupRestoreController.java
@@ -16,12 +16,12 @@
import com.github.nagyesta.lowkeyvault.service.key.impl.KeyImportInput;
import com.github.nagyesta.lowkeyvault.service.vault.VaultFake;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.lang.NonNull;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
/**
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonKeyController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonKeyController.java
index c0462c6c..29d5fbaf 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonKeyController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonKeyController.java
@@ -13,12 +13,12 @@
import com.github.nagyesta.lowkeyvault.service.key.id.KeyEntityId;
import com.github.nagyesta.lowkeyvault.service.key.id.VersionedKeyEntityId;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.lang.NonNull;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import java.util.Optional;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonKeyCryptoController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonKeyCryptoController.java
index 812eed6f..82b2f267 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonKeyCryptoController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonKeyCryptoController.java
@@ -9,12 +9,12 @@
import com.github.nagyesta.lowkeyvault.model.v7_2.key.request.KeyVerifyParameters;
import com.github.nagyesta.lowkeyvault.service.key.ReadOnlyKeyVaultKeyEntity;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.lang.NonNull;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
@Slf4j
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonSecretBackupRestoreController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonSecretBackupRestoreController.java
index a5f23a38..02513647 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonSecretBackupRestoreController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonSecretBackupRestoreController.java
@@ -15,12 +15,12 @@
import com.github.nagyesta.lowkeyvault.service.secret.impl.SecretCreateInput;
import com.github.nagyesta.lowkeyvault.service.vault.VaultFake;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.lang.NonNull;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import java.util.Objects;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonSecretController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonSecretController.java
index 481ab191..551cb850 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonSecretController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/CommonSecretController.java
@@ -12,12 +12,12 @@
import com.github.nagyesta.lowkeyvault.service.secret.id.SecretEntityId;
import com.github.nagyesta.lowkeyvault.service.secret.id.VersionedSecretEntityId;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.lang.NonNull;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
@Slf4j
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/util/CertificateRequestMapperUtil.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/util/CertificateRequestMapperUtil.java
index ef3fe5dc..a26a4adf 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/util/CertificateRequestMapperUtil.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/common/util/CertificateRequestMapperUtil.java
@@ -82,9 +82,9 @@ public static CertificateCreationInput convertPolicyToCertificateCreationInput(
.contentType(CertContentType.byMimeType(policy.getSecretProperties().getContentType()))
//x509
.subject(x509Properties.getSubject())
- .dnsNames(sans.map(SubjectAlternativeNames::getDnsNames).orElse(Set.of()))
- .emails(sans.map(SubjectAlternativeNames::getEmails).orElse(Set.of()))
- .upns(sans.map(SubjectAlternativeNames::getUpns).orElse(Set.of()))
+ .dnsNames(sans.map(SubjectAlternativeNames::dnsNames).orElse(Set.of()))
+ .emails(sans.map(SubjectAlternativeNames::emails).orElse(Set.of()))
+ .upns(sans.map(SubjectAlternativeNames::upns).orElse(Set.of()))
.keyUsage(Objects.requireNonNullElse(x509Properties.getKeyUsage(), DEFAULT_KEY_USAGES))
.extendedKeyUsage(Objects.requireNonNullElse(x509Properties.getExtendedKeyUsage(), DEFAULT_EXT_KEY_USAGES))
.validityMonths(Objects.requireNonNullElse(x509Properties.getValidityMonths(), DEFAULT_VALIDITY_MONTHS))
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/KeyBackupRestoreController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/KeyBackupRestoreController.java
index 14655cf3..06d07784 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/KeyBackupRestoreController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/KeyBackupRestoreController.java
@@ -6,6 +6,8 @@
import com.github.nagyesta.lowkeyvault.model.common.backup.KeyBackupModel;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.KeyVaultKeyModel;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@@ -14,8 +16,6 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import static com.github.nagyesta.lowkeyvault.model.common.ApiConstants.API_VERSION_7_2;
@@ -34,7 +34,7 @@ public KeyBackupRestoreController(@NonNull final KeyConverterRegistry registry,
}
@Override
- @PostMapping(value = "/keys/{keyName}/backup",
+ @PostMapping(value = {"/keys/{keyName}/backup", "/keys/{keyName}/backup/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity backup(
@@ -44,7 +44,7 @@ public ResponseEntity backup(
}
@Override
- @PostMapping(value = "/keys/restore",
+ @PostMapping(value = {"/keys/restore", "/keys/restore/"},
params = API_VERSION_7_2,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/KeyController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/KeyController.java
index bc9f1e67..1fc1a821 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/KeyController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/KeyController.java
@@ -12,6 +12,8 @@
import com.github.nagyesta.lowkeyvault.model.v7_2.key.request.ImportKeyRequest;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.request.UpdateKeyRequest;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@@ -20,8 +22,6 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import static com.github.nagyesta.lowkeyvault.model.common.ApiConstants.API_VERSION_7_2;
@@ -40,7 +40,7 @@ public KeyController(@NonNull final KeyConverterRegistry registry, @NonNull fina
}
@Override
- @PostMapping(value = "/keys/{keyName}/create",
+ @PostMapping(value = {"/keys/{keyName}/create", "/keys/{keyName}/create/"},
params = API_VERSION_7_2,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -52,7 +52,7 @@ public ResponseEntity create(
}
@Override
- @PutMapping(value = "/keys/{keyName}",
+ @PutMapping(value = {"/keys/{keyName}", "/keys/{keyName}/"},
params = API_VERSION_7_2,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -64,7 +64,7 @@ public ResponseEntity importKey(
}
@Override
- @DeleteMapping(value = "/keys/{keyName}",
+ @DeleteMapping(value = {"/keys/{keyName}", "/keys/{keyName}/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity delete(
@@ -74,7 +74,7 @@ public ResponseEntity delete(
}
@Override
- @GetMapping(value = "/keys/{keyName}/versions",
+ @GetMapping(value = {"/keys/{keyName}/versions", "/keys/{keyName}/versions/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity> versions(
@@ -86,7 +86,7 @@ public ResponseEntity> versions(
}
@Override
- @GetMapping(value = "/keys",
+ @GetMapping(value = {"/keys", "/keys/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity> listKeys(
@@ -97,7 +97,7 @@ public ResponseEntity> listKeys(
}
@Override
- @GetMapping(value = "/deletedkeys",
+ @GetMapping(value = {"/deletedkeys", "/deletedkeys/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity> listDeletedKeys(
@@ -108,7 +108,7 @@ public ResponseEntity> listDe
}
@Override
- @GetMapping(value = "/keys/{keyName}",
+ @GetMapping(value = {"/keys/{keyName}", "/keys/{keyName}/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity get(
@@ -118,7 +118,7 @@ public ResponseEntity get(
}
@Override
- @GetMapping(value = "/keys/{keyName}/{keyVersion}",
+ @GetMapping(value = {"/keys/{keyName}/{keyVersion}", "/keys/{keyName}/{keyVersion}/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity getWithVersion(
@@ -129,7 +129,7 @@ public ResponseEntity getWithVersion(
}
@Override
- @PatchMapping(value = "/keys/{keyName}/{keyVersion}",
+ @PatchMapping(value = {"/keys/{keyName}/{keyVersion}", "/keys/{keyName}/{keyVersion}/"},
params = API_VERSION_7_2,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -142,7 +142,7 @@ public ResponseEntity updateVersion(
}
@Override
- @GetMapping(value = "/deletedkeys/{keyName}",
+ @GetMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity getDeletedKey(
@@ -152,7 +152,7 @@ public ResponseEntity getDeletedKey(
}
@Override
- @PostMapping(value = "/deletedkeys/{keyName}/recover",
+ @PostMapping(value = {"/deletedkeys/{keyName}/recover", "/deletedkeys/{keyName}/recover/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity recoverDeletedKey(
@@ -162,7 +162,7 @@ public ResponseEntity recoverDeletedKey(
}
@Override
- @DeleteMapping(value = "/deletedkeys/{keyName}",
+ @DeleteMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity purgeDeleted(
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/KeyCryptoController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/KeyCryptoController.java
index a7c05087..ed1f3d22 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/KeyCryptoController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/KeyCryptoController.java
@@ -10,6 +10,8 @@
import com.github.nagyesta.lowkeyvault.model.v7_2.key.request.KeySignParameters;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.request.KeyVerifyParameters;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@@ -18,8 +20,6 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import static com.github.nagyesta.lowkeyvault.model.common.ApiConstants.API_VERSION_7_2;
@@ -38,7 +38,8 @@ public KeyCryptoController(@NonNull final KeyConverterRegistry registry, @NonNul
}
@Override
- @PostMapping(value = {"/keys/{keyName}/{keyVersion}/encrypt", "/keys/{keyName}/{keyVersion}/wrap"},
+ @PostMapping(value = {"/keys/{keyName}/{keyVersion}/encrypt", "/keys/{keyName}/{keyVersion}/encrypt/",
+ "/keys/{keyName}/{keyVersion}/wrap", "/keys/{keyName}/{keyVersion}/wrap/"},
params = API_VERSION_7_2,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -51,7 +52,8 @@ public ResponseEntity encrypt(
}
@Override
- @PostMapping(value = {"/keys/{keyName}/{keyVersion}/decrypt", "/keys/{keyName}/{keyVersion}/unwrap"},
+ @PostMapping(value = {"/keys/{keyName}/{keyVersion}/decrypt", "/keys/{keyName}/{keyVersion}/decrypt/",
+ "/keys/{keyName}/{keyVersion}/unwrap", "/keys/{keyName}/{keyVersion}/unwrap/"},
params = API_VERSION_7_2,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -64,7 +66,7 @@ public ResponseEntity decrypt(
}
@Override
- @PostMapping(value = "/keys/{keyName}/{keyVersion}/sign",
+ @PostMapping(value = {"/keys/{keyName}/{keyVersion}/sign", "/keys/{keyName}/{keyVersion}/sign/"},
params = API_VERSION_7_2,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -77,7 +79,7 @@ public ResponseEntity sign(
}
@Override
- @PostMapping(value = "/keys/{keyName}/{keyVersion}/verify",
+ @PostMapping(value = {"/keys/{keyName}/{keyVersion}/verify", "/keys/{keyName}/{keyVersion}/verify/"},
params = API_VERSION_7_2,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/SecretBackupRestoreController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/SecretBackupRestoreController.java
index 5d742837..a477ff26 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/SecretBackupRestoreController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/SecretBackupRestoreController.java
@@ -6,6 +6,8 @@
import com.github.nagyesta.lowkeyvault.model.common.backup.SecretBackupModel;
import com.github.nagyesta.lowkeyvault.model.v7_2.secret.KeyVaultSecretModel;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@@ -14,8 +16,6 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import static com.github.nagyesta.lowkeyvault.model.common.ApiConstants.API_VERSION_7_2;
@@ -34,7 +34,7 @@ public SecretBackupRestoreController(@NonNull final SecretConverterRegistry regi
}
@Override
- @PostMapping(value = "/secrets/{secretName}/backup",
+ @PostMapping(value = {"/secrets/{secretName}/backup", "/secrets/{secretName}/backup/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity backup(@PathVariable @Valid @Pattern(regexp = NAME_PATTERN) final String secretName,
@@ -43,7 +43,7 @@ public ResponseEntity backup(@PathVariable @Valid @Pattern(re
}
@Override
- @PostMapping(value = "/secrets/restore",
+ @PostMapping(value = {"/secrets/restore", "/secrets/restore/"},
params = API_VERSION_7_2,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/SecretController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/SecretController.java
index 8da86f08..16854423 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/SecretController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_2/SecretController.java
@@ -11,6 +11,8 @@
import com.github.nagyesta.lowkeyvault.model.v7_2.secret.request.CreateSecretRequest;
import com.github.nagyesta.lowkeyvault.model.v7_2.secret.request.UpdateSecretRequest;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@@ -19,8 +21,6 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import static com.github.nagyesta.lowkeyvault.model.common.ApiConstants.API_VERSION_7_2;
@@ -39,7 +39,7 @@ public SecretController(@NonNull final SecretConverterRegistry registry, @NonNul
}
@Override
- @PutMapping(value = "/secrets/{secretName}",
+ @PutMapping(value = {"/secrets/{secretName}", "/secrets/{secretName}/"},
params = API_VERSION_7_2,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -51,7 +51,7 @@ public ResponseEntity create(
}
@Override
- @DeleteMapping(value = "/secrets/{secretName}",
+ @DeleteMapping(value = {"/secrets/{secretName}", "/secrets/{secretName}/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity delete(
@@ -61,7 +61,7 @@ public ResponseEntity delete(
}
@Override
- @GetMapping(value = "/secrets/{secretName}/versions",
+ @GetMapping(value = {"/secrets/{secretName}/versions", "/secrets/{secretName}/versions/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity> versions(
@@ -73,7 +73,7 @@ public ResponseEntity> versions(
}
@Override
- @GetMapping(value = "/secrets",
+ @GetMapping(value = {"/secrets", "/secrets/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity> listSecrets(
@@ -84,7 +84,7 @@ public ResponseEntity> listSecret
}
@Override
- @GetMapping(value = "/deletedsecrets",
+ @GetMapping(value = {"/deletedsecrets", "/deletedsecrets/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity> listDeletedSecrets(
@@ -95,7 +95,7 @@ public ResponseEntity> lis
}
@Override
- @GetMapping(value = "/secrets/{secretName}",
+ @GetMapping(value = {"/secrets/{secretName}", "/secrets/{secretName}/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity get(
@@ -105,7 +105,7 @@ public ResponseEntity get(
}
@Override
- @GetMapping(value = "/secrets/{secretName}/{secretVersion}",
+ @GetMapping(value = {"/secrets/{secretName}/{secretVersion}", "/secrets/{secretName}/{secretVersion}/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity getWithVersion(
@@ -116,7 +116,7 @@ public ResponseEntity getWithVersion(
}
@Override
- @PatchMapping(value = "/secrets/{secretName}/{secretVersion}",
+ @PatchMapping(value = {"/secrets/{secretName}/{secretVersion}", "/secrets/{secretName}/{secretVersion}/"},
params = API_VERSION_7_2,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -129,7 +129,7 @@ public ResponseEntity updateVersion(
}
@Override
- @GetMapping(value = "/deletedsecrets/{secretName}",
+ @GetMapping(value = {"/deletedsecrets/{secretName}", "/deletedsecrets/{secretName}/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity getDeletedSecret(
@@ -139,7 +139,7 @@ public ResponseEntity getDeletedSecret(
}
@Override
- @DeleteMapping(value = "/deletedsecrets/{secretName}",
+ @DeleteMapping(value = {"/deletedsecrets/{secretName}", "/deletedsecrets/{secretName}/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity purgeDeleted(
@@ -149,7 +149,7 @@ public ResponseEntity purgeDeleted(
}
@Override
- @PostMapping(value = "/deletedsecrets/{secretName}/recover",
+ @PostMapping(value = {"/deletedsecrets/{secretName}/recover", "/deletedsecrets/{secretName}/recover/"},
params = API_VERSION_7_2,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity recoverDeletedSecret(
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/CertificateBackupRestoreController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/CertificateBackupRestoreController.java
index f0cd5795..b31b63a0 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/CertificateBackupRestoreController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/CertificateBackupRestoreController.java
@@ -6,6 +6,8 @@
import com.github.nagyesta.lowkeyvault.model.common.backup.CertificateBackupModel;
import com.github.nagyesta.lowkeyvault.model.v7_3.certificate.KeyVaultCertificateModel;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.DependsOn;
@@ -15,8 +17,6 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import static com.github.nagyesta.lowkeyvault.model.common.ApiConstants.API_VERSION_7_3;
@@ -37,21 +37,21 @@ public CertificateBackupRestoreController(
}
@Override
- @PostMapping(value = "/certificates/{certificateName}/backup",
+ @PostMapping(value = {"/certificates/{certificateName}/backup", "/certificates/{certificateName}/backup/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity backup(@PathVariable @Valid @Pattern(regexp = NAME_PATTERN) final String certificateName,
- @RequestAttribute(name = ApiConstants.REQUEST_BASE_URI) final URI baseUri) {
+ @RequestAttribute(name = ApiConstants.REQUEST_BASE_URI) final URI baseUri) {
return super.backup(certificateName, baseUri);
}
@Override
- @PostMapping(value = "/certificates/restore",
+ @PostMapping(value = {"/certificates/restore", "/certificates/restore/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity restore(@RequestAttribute(name = ApiConstants.REQUEST_BASE_URI) final URI baseUri,
- @Valid @RequestBody final CertificateBackupModel certificateBackupModel) {
+ @Valid @RequestBody final CertificateBackupModel certificateBackupModel) {
return super.restore(baseUri, certificateBackupModel);
}
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/CertificateController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/CertificateController.java
index c47a02be..b6e13ea5 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/CertificateController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/CertificateController.java
@@ -6,6 +6,8 @@
import com.github.nagyesta.lowkeyvault.model.common.KeyVaultItemListModel;
import com.github.nagyesta.lowkeyvault.model.v7_3.certificate.*;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@@ -14,8 +16,6 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import static com.github.nagyesta.lowkeyvault.model.common.ApiConstants.API_VERSION_7_3;
@@ -33,7 +33,8 @@ public CertificateController(@NonNull final CertificateConverterRegistry registr
}
@Override
- @PostMapping(value = "/certificates/{certificateName}/create",
+ @PostMapping(
+ value = {"/certificates/{certificateName}/create", "/certificates/{certificateName}/create/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -45,7 +46,8 @@ public ResponseEntity create(
}
@Override
- @PostMapping(value = "/certificates/{certificateName}/import",
+ @PostMapping(
+ value = {"/certificates/{certificateName}/import", "/certificates/{certificateName}/import/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -57,7 +59,8 @@ public ResponseEntity importCertificate(
}
@Override
- @GetMapping(value = "/certificates/{certificateName}",
+ @GetMapping(
+ value = {"/certificates/{certificateName}", "/certificates/{certificateName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity get(
@@ -67,7 +70,8 @@ public ResponseEntity get(
}
@Override
- @GetMapping(value = "/certificates/{certificateName}/{certificateVersion}",
+ @GetMapping(
+ value = {"/certificates/{certificateName}/{certificateVersion}", "/certificates/{certificateName}/{certificateVersion}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity getWithVersion(
@@ -78,7 +82,8 @@ public ResponseEntity getWithVersion(
}
@Override
- @DeleteMapping(value = "/certificates/{certificateName}",
+ @DeleteMapping(
+ value = {"/certificates/{certificateName}", "/certificates/{certificateName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity delete(
@@ -88,7 +93,8 @@ public ResponseEntity delete(
}
@Override
- @GetMapping(value = "/deletedcertificates/{certificateName}",
+ @GetMapping(
+ value = {"/deletedcertificates/{certificateName}", "/deletedcertificates/{certificateName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity getDeletedCertificate(
@@ -98,7 +104,8 @@ public ResponseEntity getDeletedCertificate(
}
@Override
- @PostMapping(value = "/deletedcertificates/{certificateName}/recover",
+ @PostMapping(
+ value = {"/deletedcertificates/{certificateName}/recover", "/deletedcertificates/{certificateName}/recover/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity recoverDeletedCertificate(
@@ -108,7 +115,8 @@ public ResponseEntity recoverDeletedCertificate(
}
@Override
- @DeleteMapping(value = "/deletedcertificates/{certificateName}",
+ @DeleteMapping(
+ value = {"/deletedcertificates/{certificateName}", "/deletedcertificates/{certificateName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity purgeDeleted(
@@ -118,7 +126,8 @@ public ResponseEntity purgeDeleted(
}
@Override
- @GetMapping(value = "/certificates/{certificateName}/versions",
+ @GetMapping(
+ value = {"/certificates/{certificateName}/versions", "/certificates/{certificateName}/versions/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity> versions(
@@ -130,7 +139,8 @@ public ResponseEntity> versi
}
@Override
- @GetMapping(value = "/certificates",
+ @GetMapping(
+ value = {"/certificates", "/certificates/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity> listCertificates(
@@ -142,7 +152,8 @@ public ResponseEntity> listC
}
@Override
- @GetMapping(value = "/deletedcertificates",
+ @GetMapping(
+ value = {"/deletedcertificates", "/deletedcertificates/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity> listDeletedCertificates(
@@ -154,7 +165,8 @@ public ResponseEntity
}
@Override
- @PatchMapping(value = "/certificates/{certificateName}/{certificateVersion}",
+ @PatchMapping(
+ value = {"/certificates/{certificateName}/{certificateVersion}", "/certificates/{certificateName}/{certificateVersion}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity updateCertificateProperties(
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/CertificatePolicyController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/CertificatePolicyController.java
index 667fae1a..be2ecc98 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/CertificatePolicyController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/CertificatePolicyController.java
@@ -6,6 +6,8 @@
import com.github.nagyesta.lowkeyvault.model.v7_3.certificate.CertificatePolicyModel;
import com.github.nagyesta.lowkeyvault.model.v7_3.certificate.KeyVaultPendingCertificateModel;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@@ -14,8 +16,6 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import static com.github.nagyesta.lowkeyvault.model.common.ApiConstants.API_VERSION_7_3;
@@ -33,7 +33,7 @@ public CertificatePolicyController(@NonNull final CertificateConverterRegistry r
}
@Override
- @GetMapping(value = "/certificates/{certificateName}/pending",
+ @GetMapping(value = {"/certificates/{certificateName}/pending", "/certificates/{certificateName}/pending/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity pendingCreate(
@@ -43,7 +43,7 @@ public ResponseEntity pendingCreate(
}
@Override
- @DeleteMapping(value = "/certificates/{certificateName}/pending",
+ @DeleteMapping(value = {"/certificates/{certificateName}/pending", "/certificates/{certificateName}/pending/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity pendingDelete(
@@ -53,7 +53,7 @@ public ResponseEntity pendingDelete(
}
@Override
- @GetMapping(value = "/certificates/{certificateName}/policy",
+ @GetMapping(value = {"/certificates/{certificateName}/policy", "/certificates/{certificateName}/policy/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity getPolicy(
@@ -63,7 +63,7 @@ public ResponseEntity getPolicy(
}
@Override
- @PatchMapping(value = "/certificates/{certificateName}/policy",
+ @PatchMapping(value = {"/certificates/{certificateName}/policy", "/certificates/{certificateName}/policy/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity updatePolicy(
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyBackupRestoreController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyBackupRestoreController.java
index e2833614..5bf00ecb 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyBackupRestoreController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyBackupRestoreController.java
@@ -11,6 +11,8 @@
import com.github.nagyesta.lowkeyvault.service.key.ReadOnlyRotationPolicy;
import com.github.nagyesta.lowkeyvault.service.key.id.KeyEntityId;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.DependsOn;
@@ -20,8 +22,6 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import java.util.Optional;
@@ -42,7 +42,7 @@ public KeyBackupRestoreController(@NonNull final KeyConverterRegistry registry,
}
@Override
- @PostMapping(value = "/keys/{keyName}/backup",
+ @PostMapping(value = {"/keys/{keyName}/backup", "/keys/{keyName}/backup/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity
@@ -52,7 +52,7 @@ public KeyBackupRestoreController(@NonNull final KeyConverterRegistry registry,
}
@Override
- @PostMapping(value = "/keys/restore",
+ @PostMapping(value = {"/keys/restore", "/keys/restore/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyController.java
index 3d9a71ac..e39e6921 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyController.java
@@ -14,6 +14,8 @@
import com.github.nagyesta.lowkeyvault.service.key.ReadOnlyKeyVaultKeyEntity;
import com.github.nagyesta.lowkeyvault.service.key.id.VersionedKeyEntityId;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@@ -22,8 +24,6 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import static com.github.nagyesta.lowkeyvault.model.common.ApiConstants.API_VERSION_7_3;
@@ -42,7 +42,7 @@ public KeyController(@NonNull final KeyConverterRegistry registry, @NonNull fina
}
@Override
- @PostMapping(value = "/keys/{keyName}/create",
+ @PostMapping(value = {"/keys/{keyName}/create", "/keys/{keyName}/create/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -54,7 +54,7 @@ public ResponseEntity create(
}
@Override
- @PutMapping(value = "/keys/{keyName}",
+ @PutMapping(value = {"/keys/{keyName}", "/keys/{keyName}/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -66,7 +66,7 @@ public ResponseEntity importKey(
}
@Override
- @DeleteMapping(value = "/keys/{keyName}",
+ @DeleteMapping(value = {"/keys/{keyName}", "/keys/{keyName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity delete(
@@ -76,7 +76,7 @@ public ResponseEntity delete(
}
@Override
- @GetMapping(value = "/keys/{keyName}/versions",
+ @GetMapping(value = {"/keys/{keyName}/versions", "/keys/{keyName}/versions/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity> versions(
@@ -88,7 +88,7 @@ public ResponseEntity> versions(
}
@Override
- @GetMapping(value = "/keys",
+ @GetMapping(value = {"/keys", "/keys/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity> listKeys(
@@ -99,7 +99,7 @@ public ResponseEntity> listKeys(
}
@Override
- @GetMapping(value = "/deletedkeys",
+ @GetMapping(value = {"/deletedkeys", "/deletedkeys/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity> listDeletedKeys(
@@ -110,7 +110,7 @@ public ResponseEntity> listDe
}
@Override
- @GetMapping(value = "/keys/{keyName}",
+ @GetMapping(value = {"/keys/{keyName}", "/keys/{keyName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity get(
@@ -120,7 +120,7 @@ public ResponseEntity get(
}
@Override
- @GetMapping(value = "/keys/{keyName}/{keyVersion}",
+ @GetMapping(value = {"/keys/{keyName}/{keyVersion}", "/keys/{keyName}/{keyVersion}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity getWithVersion(
@@ -131,7 +131,7 @@ public ResponseEntity getWithVersion(
}
@Override
- @PatchMapping(value = "/keys/{keyName}/{keyVersion}",
+ @PatchMapping(value = {"/keys/{keyName}/{keyVersion}", "/keys/{keyName}/{keyVersion}/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -143,7 +143,7 @@ public ResponseEntity updateVersion(
return super.updateVersion(keyName, keyVersion, baseUri, request);
}
- @PostMapping(value = "/keys/{keyName}/rotate",
+ @PostMapping(value = {"/keys/{keyName}/rotate", "/keys/{keyName}/rotate/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity rotateKey(
@@ -158,7 +158,7 @@ public ResponseEntity rotateKey(
}
@Override
- @GetMapping(value = "/deletedkeys/{keyName}",
+ @GetMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity getDeletedKey(
@@ -168,7 +168,7 @@ public ResponseEntity getDeletedKey(
}
@Override
- @PostMapping(value = "/deletedkeys/{keyName}/recover",
+ @PostMapping(value = {"/deletedkeys/{keyName}/recover", "/deletedkeys/{keyName}/recover/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity recoverDeletedKey(
@@ -178,7 +178,7 @@ public ResponseEntity recoverDeletedKey(
}
@Override
- @DeleteMapping(value = "/deletedkeys/{keyName}",
+ @DeleteMapping(value = {"/deletedkeys/{keyName}", "/deletedkeys/{keyName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity purgeDeleted(
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyCryptoController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyCryptoController.java
index 67c7f05e..4b14f5e2 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyCryptoController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyCryptoController.java
@@ -13,6 +13,8 @@
import com.github.nagyesta.lowkeyvault.model.v7_3.key.RandomBytesResponse;
import com.github.nagyesta.lowkeyvault.service.key.util.KeyGenUtil;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@@ -21,8 +23,6 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import static com.github.nagyesta.lowkeyvault.model.common.ApiConstants.API_VERSION_7_3;
@@ -41,7 +41,8 @@ public KeyCryptoController(@NonNull final KeyConverterRegistry registry, @NonNul
}
@Override
- @PostMapping(value = {"/keys/{keyName}/{keyVersion}/encrypt", "/keys/{keyName}/{keyVersion}/wrap"},
+ @PostMapping(value = {"/keys/{keyName}/{keyVersion}/encrypt", "/keys/{keyName}/{keyVersion}/encrypt/",
+ "/keys/{keyName}/{keyVersion}/wrap", "/keys/{keyName}/{keyVersion}/wrap/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -54,7 +55,8 @@ public ResponseEntity encrypt(
}
@Override
- @PostMapping(value = {"/keys/{keyName}/{keyVersion}/decrypt", "/keys/{keyName}/{keyVersion}/unwrap"},
+ @PostMapping(value = {"/keys/{keyName}/{keyVersion}/decrypt", "/keys/{keyName}/{keyVersion}/decrypt/",
+ "/keys/{keyName}/{keyVersion}/unwrap", "/keys/{keyName}/{keyVersion}/unwrap/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -67,7 +69,7 @@ public ResponseEntity decrypt(
}
@Override
- @PostMapping(value = "/keys/{keyName}/{keyVersion}/sign",
+ @PostMapping(value = {"/keys/{keyName}/{keyVersion}/sign", "/keys/{keyName}/{keyVersion}/sign/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -80,7 +82,7 @@ public ResponseEntity sign(
}
@Override
- @PostMapping(value = "/keys/{keyName}/{keyVersion}/verify",
+ @PostMapping(value = {"/keys/{keyName}/{keyVersion}/verify", "/keys/{keyName}/{keyVersion}/verify/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -92,7 +94,7 @@ public ResponseEntity verify(
return super.verify(keyName, keyVersion, baseUri, request);
}
- @PostMapping(value = "/rng",
+ @PostMapping(value = {"/rng", "/rng/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyPolicyController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyPolicyController.java
index 7a63fcae..cf9f0cf5 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyPolicyController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/KeyPolicyController.java
@@ -11,6 +11,8 @@
import com.github.nagyesta.lowkeyvault.service.key.RotationPolicy;
import com.github.nagyesta.lowkeyvault.service.key.id.KeyEntityId;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.lang.NonNull;
@@ -18,8 +20,6 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import static com.github.nagyesta.lowkeyvault.model.common.ApiConstants.API_VERSION_7_3;
@@ -36,7 +36,7 @@ public KeyPolicyController(@NonNull final KeyConverterRegistry registry, @NonNul
super(registry, vaultService);
}
- @GetMapping(value = "/keys/{keyName}/rotationpolicy",
+ @GetMapping(value = {"/keys/{keyName}/rotationpolicy", "/keys/{keyName}/rotationpolicy/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity getRotationPolicy(
@@ -47,7 +47,7 @@ public ResponseEntity getRotationPolicy(
return getRotationPolicyResponseEntity(getVaultByUri(baseUri), entityId(baseUri, keyName), baseUri);
}
- @PutMapping(value = "/keys/{keyName}/rotationpolicy",
+ @PutMapping(value = {"/keys/{keyName}/rotationpolicy", "/keys/{keyName}/rotationpolicy/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/SecretBackupRestoreController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/SecretBackupRestoreController.java
index dee4633b..97757d1c 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/SecretBackupRestoreController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/SecretBackupRestoreController.java
@@ -6,6 +6,8 @@
import com.github.nagyesta.lowkeyvault.model.common.backup.SecretBackupModel;
import com.github.nagyesta.lowkeyvault.model.v7_2.secret.KeyVaultSecretModel;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.DependsOn;
@@ -15,8 +17,6 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import static com.github.nagyesta.lowkeyvault.model.common.ApiConstants.API_VERSION_7_3;
@@ -36,7 +36,7 @@ public SecretBackupRestoreController(@NonNull final SecretConverterRegistry regi
}
@Override
- @PostMapping(value = "/secrets/{secretName}/backup",
+ @PostMapping(value = {"/secrets/{secretName}/backup", "/secrets/{secretName}/backup/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity backup(@PathVariable @Valid @Pattern(regexp = NAME_PATTERN) final String secretName,
@@ -45,7 +45,7 @@ public ResponseEntity backup(@PathVariable @Valid @Pattern(re
}
@Override
- @PostMapping(value = "/secrets/restore",
+ @PostMapping(value = {"/secrets/restore", "/secrets/restore/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/SecretController.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/SecretController.java
index 60e23268..0c354eef 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/SecretController.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/controller/v7_3/SecretController.java
@@ -11,6 +11,8 @@
import com.github.nagyesta.lowkeyvault.model.v7_2.secret.request.CreateSecretRequest;
import com.github.nagyesta.lowkeyvault.model.v7_2.secret.request.UpdateSecretRequest;
import com.github.nagyesta.lowkeyvault.service.vault.VaultService;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@@ -19,8 +21,6 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import javax.validation.Valid;
-import javax.validation.constraints.Pattern;
import java.net.URI;
import static com.github.nagyesta.lowkeyvault.model.common.ApiConstants.API_VERSION_7_3;
@@ -39,7 +39,7 @@ public SecretController(@NonNull final SecretConverterRegistry registry, @NonNul
}
@Override
- @PutMapping(value = "/secrets/{secretName}",
+ @PutMapping(value = {"/secrets/{secretName}", "/secrets/{secretName}/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -51,7 +51,7 @@ public ResponseEntity create(
}
@Override
- @DeleteMapping(value = "/secrets/{secretName}",
+ @DeleteMapping(value = {"/secrets/{secretName}", "/secrets/{secretName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity delete(
@@ -61,7 +61,7 @@ public ResponseEntity delete(
}
@Override
- @GetMapping(value = "/secrets/{secretName}/versions",
+ @GetMapping(value = {"/secrets/{secretName}/versions", "/secrets/{secretName}/versions/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity> versions(
@@ -73,7 +73,7 @@ public ResponseEntity> versions(
}
@Override
- @GetMapping(value = "/secrets",
+ @GetMapping(value = {"/secrets", "/secrets/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity> listSecrets(
@@ -84,7 +84,7 @@ public ResponseEntity> listSecret
}
@Override
- @GetMapping(value = "/deletedsecrets",
+ @GetMapping(value = {"/deletedsecrets", "/deletedsecrets/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity> listDeletedSecrets(
@@ -95,7 +95,7 @@ public ResponseEntity> lis
}
@Override
- @GetMapping(value = "/secrets/{secretName}",
+ @GetMapping(value = {"/secrets/{secretName}", "/secrets/{secretName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity get(
@@ -105,7 +105,7 @@ public ResponseEntity get(
}
@Override
- @GetMapping(value = "/secrets/{secretName}/{secretVersion}",
+ @GetMapping(value = {"/secrets/{secretName}/{secretVersion}", "/secrets/{secretName}/{secretVersion}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity getWithVersion(
@@ -116,7 +116,7 @@ public ResponseEntity getWithVersion(
}
@Override
- @PatchMapping(value = "/secrets/{secretName}/{secretVersion}",
+ @PatchMapping(value = {"/secrets/{secretName}/{secretVersion}", "/secrets/{secretName}/{secretVersion}/"},
params = API_VERSION_7_3,
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
@@ -129,7 +129,7 @@ public ResponseEntity updateVersion(
}
@Override
- @GetMapping(value = "/deletedsecrets/{secretName}",
+ @GetMapping(value = {"/deletedsecrets/{secretName}", "/deletedsecrets/{secretName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity getDeletedSecret(
@@ -139,7 +139,7 @@ public ResponseEntity getDeletedSecret(
}
@Override
- @DeleteMapping(value = "/deletedsecrets/{secretName}",
+ @DeleteMapping(value = {"/deletedsecrets/{secretName}", "/deletedsecrets/{secretName}/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity purgeDeleted(
@@ -149,7 +149,7 @@ public ResponseEntity purgeDeleted(
}
@Override
- @PostMapping(value = "/deletedsecrets/{secretName}/recover",
+ @PostMapping(value = {"/deletedsecrets/{secretName}/recover", "/deletedsecrets/{secretName}/recover/"},
params = API_VERSION_7_3,
produces = APPLICATION_JSON_VALUE)
public ResponseEntity recoverDeletedSecret(
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/filter/CommonAuthHeaderFilter.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/filter/CommonAuthHeaderFilter.java
index 4989cff5..8f4a5406 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/filter/CommonAuthHeaderFilter.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/filter/CommonAuthHeaderFilter.java
@@ -1,6 +1,10 @@
package com.github.nagyesta.lowkeyvault.filter;
import com.github.nagyesta.lowkeyvault.model.common.ApiConstants;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpHeaders;
import org.springframework.lang.NonNull;
@@ -9,10 +13,6 @@
import org.springframework.util.StringUtils;
import org.springframework.web.filter.OncePerRequestFilter;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URI;
import java.util.Set;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/mapper/v7_3/key/KeyRotationPolicyToV73ModelConverter.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/mapper/v7_3/key/KeyRotationPolicyToV73ModelConverter.java
index cbcbdefe..d7964bd5 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/mapper/v7_3/key/KeyRotationPolicyToV73ModelConverter.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/mapper/v7_3/key/KeyRotationPolicyToV73ModelConverter.java
@@ -64,8 +64,8 @@ private List convertLifetimeActions(final Map convertLifetimeActions(final List lifetimeActions) {
return lifetimeActions.stream()
.map(this::convertLifetimeAction)
- .collect(Collectors.toMap(LifetimeAction::getActionType, Function.identity()));
+ .collect(Collectors.toMap(LifetimeAction::actionType, Function.identity()));
}
private LifetimeAction convertLifetimeAction(final KeyLifetimeActionModel source) {
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/ErrorModel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/ErrorModel.java
index acb99986..fe702382 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/ErrorModel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/ErrorModel.java
@@ -1,17 +1,8 @@
package com.github.nagyesta.lowkeyvault.model.common;
import com.fasterxml.jackson.annotation.JsonProperty;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.ToString;
-
-@Getter
-@ToString
-@EqualsAndHashCode
-public class ErrorModel {
- @JsonProperty("error")
- private final ErrorMessage error;
+public record ErrorModel(@JsonProperty("error") ErrorMessage error) {
public ErrorModel(final ErrorMessage error) {
this.error = error;
}
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/CertificateBackupList.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/CertificateBackupList.java
index 22d42740..8b9f8810 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/CertificateBackupList.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/CertificateBackupList.java
@@ -2,11 +2,11 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.BackupListContainer;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.EqualsAndHashCode;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
import java.util.List;
@EqualsAndHashCode
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/CertificateBackupListItem.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/CertificateBackupListItem.java
index 46250971..b3ca4fe7 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/CertificateBackupListItem.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/CertificateBackupListItem.java
@@ -10,12 +10,11 @@
import com.github.nagyesta.lowkeyvault.model.v7_2.common.BaseBackupListItem;
import com.github.nagyesta.lowkeyvault.model.v7_3.certificate.CertificatePolicyModel;
import com.github.nagyesta.lowkeyvault.model.v7_3.certificate.CertificatePropertiesModel;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
-import javax.validation.constraints.NotNull;
-
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/KeyBackupList.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/KeyBackupList.java
index e4d082d3..01a42e36 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/KeyBackupList.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/KeyBackupList.java
@@ -4,13 +4,16 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.BackupListContainer;
import com.github.nagyesta.lowkeyvault.model.v7_3.key.KeyRotationPolicyModel;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
import java.util.List;
+@Getter
@EqualsAndHashCode
public class KeyBackupList implements BackupListContainer {
@@ -20,24 +23,14 @@ public class KeyBackupList implements BackupListContainer {
@JsonProperty("versions")
private List versions = List.of();
- public List getVersions() {
- return versions;
- }
-
- public void setVersions(final List versions) {
- this.versions = List.copyOf(versions);
- }
-
+ @Setter
@Valid
@JsonProperty("rotationPolicy")
@JsonInclude(JsonInclude.Include.NON_NULL)
private KeyRotationPolicyModel keyRotationPolicy;
- public KeyRotationPolicyModel getKeyRotationPolicy() {
- return keyRotationPolicy;
+ public void setVersions(final List versions) {
+ this.versions = List.copyOf(versions);
}
- public void setKeyRotationPolicy(final KeyRotationPolicyModel keyRotationPolicy) {
- this.keyRotationPolicy = keyRotationPolicy;
- }
}
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/KeyBackupListItem.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/KeyBackupListItem.java
index 10435261..410460dc 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/KeyBackupListItem.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/KeyBackupListItem.java
@@ -4,13 +4,12 @@
import com.github.nagyesta.lowkeyvault.model.v7_2.common.BaseBackupListItem;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.KeyPropertiesModel;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.request.JsonWebKeyImportRequest;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/SecretBackupList.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/SecretBackupList.java
index e97b777a..cb6546d0 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/SecretBackupList.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/SecretBackupList.java
@@ -2,13 +2,15 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.BackupListContainer;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.EqualsAndHashCode;
+import lombok.Getter;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
import java.util.List;
+@Getter
@EqualsAndHashCode
public class SecretBackupList implements BackupListContainer {
@@ -18,10 +20,6 @@ public class SecretBackupList implements BackupListContainer versions = List.of();
- public List getVersions() {
- return versions;
- }
-
public void setVersions(final List versions) {
this.versions = List.copyOf(versions);
}
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/SecretBackupListItem.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/SecretBackupListItem.java
index 4236fd96..0f54867e 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/SecretBackupListItem.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/common/backup/SecretBackupListItem.java
@@ -3,12 +3,11 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.nagyesta.lowkeyvault.model.v7_2.common.BaseBackupListItem;
import com.github.nagyesta.lowkeyvault.model.v7_2.secret.SecretPropertiesModel;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
-import javax.validation.constraints.NotNull;
-
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/json/util/AbstractBase64ZipDeserializer.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/json/util/AbstractBase64ZipDeserializer.java
index 0a5d87cb..859db47f 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/json/util/AbstractBase64ZipDeserializer.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/json/util/AbstractBase64ZipDeserializer.java
@@ -1,6 +1,5 @@
package com.github.nagyesta.lowkeyvault.model.json.util;
-import com.fasterxml.jackson.core.JacksonException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
@@ -29,7 +28,7 @@ protected AbstractBase64ZipDeserializer(final Base64Deserializer base64Deseriali
}
@Override
- public E deserialize(final JsonParser jsonParser, final DeserializationContext context) throws IOException, JacksonException {
+ public E deserialize(final JsonParser jsonParser, final DeserializationContext context) throws IOException {
final Optional bytes = Optional.ofNullable(base64Deserializer.deserializeBase64(jsonParser));
return bytes.filter(v -> v.length > 0)
.map(this::decompressWrappedObject)
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/management/VaultBackupListModel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/management/VaultBackupListModel.java
index 0860ec2c..adc8139e 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/management/VaultBackupListModel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/management/VaultBackupListModel.java
@@ -2,11 +2,11 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.Data;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
import java.util.List;
@Data
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/management/VaultBackupModel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/management/VaultBackupModel.java
index 2fa06d97..2d20f8e7 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/management/VaultBackupModel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/management/VaultBackupModel.java
@@ -5,10 +5,10 @@
import com.github.nagyesta.lowkeyvault.model.common.backup.CertificateBackupList;
import com.github.nagyesta.lowkeyvault.model.common.backup.KeyBackupList;
import com.github.nagyesta.lowkeyvault.model.common.backup.SecretBackupList;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
import java.util.Map;
@Data
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/management/VaultModel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/management/VaultModel.java
index d6c0f0d8..c84a8665 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/management/VaultModel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/management/VaultModel.java
@@ -8,9 +8,9 @@
import com.github.nagyesta.lowkeyvault.model.json.util.EpochSecondsSerializer;
import com.github.nagyesta.lowkeyvault.model.v7_2.common.constants.RecoveryLevel;
import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.NotNull;
import java.net.URI;
import java.time.OffsetDateTime;
import java.util.Set;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/common/BaseBackupListItem.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/common/BaseBackupListItem.java
index 1b86eaac..7ee51555 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/common/BaseBackupListItem.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/common/BaseBackupListItem.java
@@ -3,11 +3,11 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.nagyesta.lowkeyvault.model.v7_2.BasePropertiesModel;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.Valid;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
import java.net.URI;
import java.util.Map;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/common/BaseBackupModel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/common/BaseBackupModel.java
index dd752d73..951a9df8 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/common/BaseBackupModel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/common/BaseBackupModel.java
@@ -3,11 +3,10 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.github.nagyesta.lowkeyvault.model.v7_2.BasePropertiesModel;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.BackupListContainer;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-
/**
* Base class of backup models.
*
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/common/constants/RecoveryLevel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/common/constants/RecoveryLevel.java
index 264add45..4f981e43 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/common/constants/RecoveryLevel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/common/constants/RecoveryLevel.java
@@ -9,7 +9,7 @@ public enum RecoveryLevel {
/**
* Purgeable and not recoverable, subscription not protected.
- * See: https://docs.microsoft.com/en-us/rest/api/keyvault/create-key/create-key#deletionrecoverylevel
+ * See: source
*/
PURGEABLE("Purgeable") {
@Override
@@ -31,7 +31,7 @@ public void checkValidRecoverableDays(final Integer recoverableDays) {
},
/**
* Purgeable and recoverable, subscription not protected.
- * See: https://docs.microsoft.com/en-us/rest/api/keyvault/create-key/create-key#deletionrecoverylevel
+ * See: source
*/
RECOVERABLE_AND_PURGEABLE("Recoverable+Purgeable") {
@Override
@@ -41,12 +41,12 @@ public boolean isPurgeable() {
},
/**
* Recoverable, not purgeable, subscription not protected.
- * See: https://docs.microsoft.com/en-us/rest/api/keyvault/create-key/create-key#deletionrecoverylevel
+ * See: source
*/
RECOVERABLE("Recoverable"),
/**
* Recoverable, not purgeable, subscription protected.
- * See: https://docs.microsoft.com/en-us/rest/api/keyvault/create-key/create-key#deletionrecoverylevel
+ * See: source
*/
RECOVERABLE_AND_PROTECTED_SUBSCRIPTION("Recoverable+ProtectedSubscription") {
@Override
@@ -56,7 +56,7 @@ public boolean isSubscriptionProtected() {
},
/**
* Recoverable for a customized time, purgeable, subscription not protected.
- * See: https://docs.microsoft.com/en-us/rest/api/keyvault/create-key/create-key#deletionrecoverylevel
+ * See: source
*/
CUSTOMIZED_RECOVERABLE_AND_PURGEABLE("CustomizedRecoverable+Purgeable") {
@Override
@@ -71,7 +71,7 @@ public boolean isCustomized() {
},
/**
* Recoverable for a customized time, not purgeable, subscription not protected.
- * See: https://docs.microsoft.com/en-us/rest/api/keyvault/create-key/create-key#deletionrecoverylevel
+ * See: source
*/
CUSTOMIZED_RECOVERABLE("CustomizedRecoverable") {
@Override
@@ -82,7 +82,7 @@ public boolean isCustomized() {
/**
* Recoverable for a customized time, not purgeable, subscription protected.
- * See: https://docs.microsoft.com/en-us/rest/api/keyvault/create-key/create-key#deletionrecoverylevel
+ * See: source
*/
CUSTOMIZED_RECOVERABLE_AND_PROTECTED_SUBSCRIPTION("CustomizedRecoverable+ProtectedSubscription") {
@Override
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/constants/HashAlgorithm.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/constants/HashAlgorithm.java
index a57bd3a2..c21fc00b 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/constants/HashAlgorithm.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/constants/HashAlgorithm.java
@@ -1,5 +1,6 @@
package com.github.nagyesta.lowkeyvault.model.v7_2.key.constants;
+import lombok.Getter;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.DERNull;
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
@@ -13,12 +14,13 @@
import java.security.spec.PSSParameterSpec;
import java.util.Optional;
-@SuppressWarnings("checkstyle:JavadocVariable")
+@SuppressWarnings({"checkstyle:JavadocVariable", "LombokGetterMayBeUsed"})
public enum HashAlgorithm {
SHA256("SHA-256", 32, NISTObjectIdentifiers.id_sha256),
SHA384("SHA-384", 48, NISTObjectIdentifiers.id_sha384),
SHA512("SHA-512", 64, NISTObjectIdentifiers.id_sha512);
+ @Getter
private final String algorithmName;
private final ASN1ObjectIdentifier algorithmIdentifier;
private final int digestLength;
@@ -29,10 +31,6 @@ public enum HashAlgorithm {
this.digestLength = digestLength;
}
- public String getAlgorithmName() {
- return algorithmName;
- }
-
public byte[] encodeDigest(final byte[] digest) throws IOException {
return new DigestInfo(new AlgorithmIdentifier(algorithmIdentifier, DERNull.INSTANCE), digest).getEncoded();
}
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/constants/KeyCurveName.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/constants/KeyCurveName.java
index f1f707bb..8e2f73cf 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/constants/KeyCurveName.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/constants/KeyCurveName.java
@@ -15,27 +15,31 @@ public enum KeyCurveName {
/**
* P-256.
*/
- P_256("P-256", "secp256r1", Set.of("prime256v1")),
+ P_256("P-256", "secp256r1", Set.of("prime256v1"), 256),
/**
* P-384.
*/
- P_384("P-384", "secp384r1", Set.of()),
+ P_384("P-384", "secp384r1", Set.of(), 384),
/**
* P-521.
*/
- P_521("P-521", "secp521r1", Set.of()),
+ P_521("P-521", "secp521r1", Set.of(), 521),
/**
* P-256K.
*/
- P_256K("P-256K", "secp256k1", Set.of());
+ P_256K("P-256K", "secp256k1", Set.of(), 256);
+ private static final double BITS_PER_BYTE = 8.0D;
private final String value;
private final String alg;
+
+ private final int bitLength;
private final Set equivalentAlgs;
- KeyCurveName(final String value, final String alg, final Set equivalentAlgs) {
+ KeyCurveName(final String value, final String alg, final Set equivalentAlgs, final int bitLength) {
this.value = value;
this.alg = alg;
+ this.bitLength = bitLength;
final TreeSet algSet = new TreeSet<>(equivalentAlgs);
algSet.add(alg);
this.equivalentAlgs = algSet;
@@ -59,4 +63,14 @@ public String getValue() {
public AlgorithmParameterSpec getAlgSpec() {
return new ECGenParameterSpec(alg);
}
+
+ @JsonIgnore
+ public int getBitLength() {
+ return bitLength;
+ }
+
+ @JsonIgnore
+ public int getByteLength() {
+ return (int) Math.ceil(getBitLength() / BITS_PER_BYTE);
+ }
}
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/constants/SignatureAlgorithm.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/constants/SignatureAlgorithm.java
index 53f5f51d..4339ab96 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/constants/SignatureAlgorithm.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/constants/SignatureAlgorithm.java
@@ -13,49 +13,29 @@
@SuppressWarnings("checkstyle:JavadocVariable")
public enum SignatureAlgorithm {
- ES256("ES256", "NONEwithECDSAinP1363Format", KeyType.EC, HashAlgorithm.SHA256) {
+ ES256("ES256", "NONEwithECDSA", KeyType.EC, HashAlgorithm.SHA256) {
@Override
public boolean isCompatibleWithCurve(final KeyCurveName keyCurveName) {
return KeyCurveName.P_256 == keyCurveName;
}
-
- @Override
- public Signature getSignatureInstance() throws GeneralSecurityException {
- return Signature.getInstance(getAlg());
- }
},
- ES256K("ES256K", "NONEwithECDSAinP1363Format", KeyType.EC, HashAlgorithm.SHA256) {
+ ES256K("ES256K", "NONEwithECDSA", KeyType.EC, HashAlgorithm.SHA256) {
@Override
public boolean isCompatibleWithCurve(final KeyCurveName keyCurveName) {
return KeyCurveName.P_256K == keyCurveName;
}
-
- @Override
- public Signature getSignatureInstance() throws GeneralSecurityException {
- return Signature.getInstance(getAlg());
- }
},
- ES384("ES384", "NONEwithECDSAinP1363Format", KeyType.EC, HashAlgorithm.SHA384) {
+ ES384("ES384", "NONEwithECDSA", KeyType.EC, HashAlgorithm.SHA384) {
@Override
public boolean isCompatibleWithCurve(final KeyCurveName keyCurveName) {
return KeyCurveName.P_384 == keyCurveName;
}
-
- @Override
- public Signature getSignatureInstance() throws GeneralSecurityException {
- return Signature.getInstance(getAlg());
- }
},
- ES512("ES512", "NONEwithECDSAinP1363Format", KeyType.EC, HashAlgorithm.SHA512) {
+ ES512("ES512", "NONEwithECDSA", KeyType.EC, HashAlgorithm.SHA512) {
@Override
public boolean isCompatibleWithCurve(final KeyCurveName keyCurveName) {
return KeyCurveName.P_521 == keyCurveName;
}
-
- @Override
- public Signature getSignatureInstance() throws GeneralSecurityException {
- return Signature.getInstance(getAlg());
- }
},
PS256("PS256", "NONEwithRSAandMGF1", KeyType.RSA, HashAlgorithm.SHA256) {
@Override
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/CreateKeyRequest.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/CreateKeyRequest.java
index e4c52997..6d42a1d2 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/CreateKeyRequest.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/CreateKeyRequest.java
@@ -11,13 +11,13 @@
import com.github.nagyesta.lowkeyvault.service.key.impl.KeyCreationInput;
import com.github.nagyesta.lowkeyvault.service.key.impl.OctKeyCreationInput;
import com.github.nagyesta.lowkeyvault.service.key.impl.RsaKeyCreationInput;
+import jakarta.validation.constraints.Max;
+import jakarta.validation.constraints.Min;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.springframework.lang.NonNull;
import org.springframework.util.Assert;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/ImportKeyRequest.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/ImportKeyRequest.java
index b3259f77..34f2f5cb 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/ImportKeyRequest.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/ImportKeyRequest.java
@@ -3,10 +3,10 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.nagyesta.lowkeyvault.model.v7_2.BasePropertiesUpdateModel;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
import java.util.Map;
@SuppressWarnings("checkstyle:MagicNumber")
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/JsonWebKeyImportRequest.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/JsonWebKeyImportRequest.java
index 13a684ef..e61c0aaf 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/JsonWebKeyImportRequest.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/JsonWebKeyImportRequest.java
@@ -10,11 +10,11 @@
import com.github.nagyesta.lowkeyvault.model.v7_2.key.constants.KeyOperation;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.constants.KeyType;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.validator.*;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Null;
+import jakarta.validation.constraints.Size;
import lombok.Data;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Null;
-import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/KeyOperationsParameters.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/KeyOperationsParameters.java
index 799461e0..7974d4a4 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/KeyOperationsParameters.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/KeyOperationsParameters.java
@@ -8,10 +8,10 @@
import com.github.nagyesta.lowkeyvault.model.json.util.Base64Deserializer;
import com.github.nagyesta.lowkeyvault.model.json.util.Base64Serializer;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.constants.EncryptionAlgorithm;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
import java.util.Base64;
import java.util.Optional;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/KeySignParameters.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/KeySignParameters.java
index 9b3e5027..392d1180 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/KeySignParameters.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/KeySignParameters.java
@@ -4,10 +4,10 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.constants.SignatureAlgorithm;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
import java.util.Base64;
import java.util.Optional;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/KeyVerifyParameters.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/KeyVerifyParameters.java
index 36b37db0..61c5597e 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/KeyVerifyParameters.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/request/KeyVerifyParameters.java
@@ -4,10 +4,10 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.constants.SignatureAlgorithm;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
import java.util.Base64;
import java.util.Optional;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/validator/ImportKeyValidator.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/validator/ImportKeyValidator.java
index f779643b..c1033511 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/validator/ImportKeyValidator.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/validator/ImportKeyValidator.java
@@ -2,13 +2,13 @@
import com.github.nagyesta.lowkeyvault.model.v7_2.key.constants.KeyType;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.request.JsonWebKeyImportRequest;
+import jakarta.validation.ConstraintValidator;
+import jakarta.validation.ConstraintValidatorContext;
+import jakarta.validation.ConstraintViolation;
+import jakarta.validation.Validator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
import java.util.Set;
@Component
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/validator/ValidImportKey.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/validator/ValidImportKey.java
index 4d457bba..cae94348 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/validator/ValidImportKey.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/key/validator/ValidImportKey.java
@@ -1,7 +1,8 @@
package com.github.nagyesta.lowkeyvault.model.v7_2.key.validator;
-import javax.validation.Constraint;
-import javax.validation.Payload;
+import jakarta.validation.Constraint;
+import jakarta.validation.Payload;
+
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/secret/request/CreateSecretRequest.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/secret/request/CreateSecretRequest.java
index 44ef5ee0..4d3a3c94 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/secret/request/CreateSecretRequest.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_2/secret/request/CreateSecretRequest.java
@@ -3,10 +3,10 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.nagyesta.lowkeyvault.model.v7_2.secret.SecretPropertiesModel;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
import java.util.Map;
@Data
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateImportRequest.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateImportRequest.java
index 02dd7730..47f408ef 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateImportRequest.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateImportRequest.java
@@ -6,10 +6,10 @@
import com.github.nagyesta.lowkeyvault.controller.common.util.CertificateRequestMapperUtil;
import com.github.nagyesta.lowkeyvault.model.json.util.Base64CertDeserializer;
import com.github.nagyesta.lowkeyvault.model.json.util.Base64CertSerializer;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
import java.util.Map;
@Data
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateKeyModel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateKeyModel.java
index 7ead2082..e74b99b2 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateKeyModel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateKeyModel.java
@@ -4,12 +4,11 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.constants.KeyCurveName;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.constants.KeyType;
+import jakarta.validation.constraints.Max;
+import jakarta.validation.constraints.Min;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-
@Data
public class CertificateKeyModel {
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateLifetimeActionModel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateLifetimeActionModel.java
index 78877986..37014570 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateLifetimeActionModel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateLifetimeActionModel.java
@@ -6,11 +6,10 @@
import com.github.nagyesta.lowkeyvault.model.json.util.CertificateLifetimeActionDeserializer;
import com.github.nagyesta.lowkeyvault.model.json.util.CertificateLifetimeActionSerializer;
import com.github.nagyesta.lowkeyvault.service.certificate.CertificateLifetimeActionActivity;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-
@Data
public class CertificateLifetimeActionModel {
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateLifetimeActionTriggerModel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateLifetimeActionTriggerModel.java
index eade177a..d5192154 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateLifetimeActionTriggerModel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateLifetimeActionTriggerModel.java
@@ -4,12 +4,12 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.nagyesta.lowkeyvault.service.certificate.CertificateLifetimeActionTrigger;
import com.github.nagyesta.lowkeyvault.service.certificate.CertificateLifetimeActionTriggerType;
+import jakarta.validation.constraints.Max;
+import jakarta.validation.constraints.Min;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.Assert;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
import java.util.Optional;
@Data
@@ -27,10 +27,10 @@ public class CertificateLifetimeActionTriggerModel {
private Integer daysBeforeExpiry;
public CertificateLifetimeActionTriggerModel(final CertificateLifetimeActionTrigger trigger) {
- if (trigger.getTriggerType() == CertificateLifetimeActionTriggerType.DAYS_BEFORE_EXPIRY) {
- this.daysBeforeExpiry = trigger.getValue();
+ if (trigger.triggerType() == CertificateLifetimeActionTriggerType.DAYS_BEFORE_EXPIRY) {
+ this.daysBeforeExpiry = trigger.value();
} else {
- this.lifetimePercentage = trigger.getValue();
+ this.lifetimePercentage = trigger.value();
}
}
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificatePolicyModel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificatePolicyModel.java
index b5d696c7..3fe6dfb5 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificatePolicyModel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificatePolicyModel.java
@@ -2,11 +2,11 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.Data;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
import java.util.List;
@Data
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateSecretModel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateSecretModel.java
index 539f5d82..136f9e42 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateSecretModel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CertificateSecretModel.java
@@ -1,10 +1,9 @@
package com.github.nagyesta.lowkeyvault.model.v7_3.certificate;
import com.fasterxml.jackson.annotation.JsonProperty;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.NotNull;
-
@Data
public class CertificateSecretModel {
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CreateCertificateRequest.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CreateCertificateRequest.java
index 911f61cf..993dfc55 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CreateCertificateRequest.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/CreateCertificateRequest.java
@@ -2,10 +2,10 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
import java.util.Map;
@Data
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/SubjectAlternativeNames.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/SubjectAlternativeNames.java
index 489c15c7..bb9b63ac 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/SubjectAlternativeNames.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/SubjectAlternativeNames.java
@@ -2,26 +2,14 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
-import lombok.Data;
import java.util.Set;
-@Data
-public class SubjectAlternativeNames {
-
- @JsonProperty("dns_names")
- private final Set dnsNames;
- @JsonProperty("emails")
- private final Set emails;
- @JsonProperty("upns")
- private final Set upns;
+public record SubjectAlternativeNames(@JsonProperty("dns_names") Set dnsNames,
+ @JsonProperty("emails") Set emails,
+ @JsonProperty("upns") Set upns) {
@JsonCreator
- public SubjectAlternativeNames(@JsonProperty("dns_names") final Set dnsNames,
- @JsonProperty("emails") final Set emails,
- @JsonProperty("upns") final Set upns) {
- this.dnsNames = dnsNames;
- this.emails = emails;
- this.upns = upns;
+ public SubjectAlternativeNames {
}
}
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/X509CertificateModel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/X509CertificateModel.java
index d0b229f3..e90f7b60 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/X509CertificateModel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/certificate/X509CertificateModel.java
@@ -2,11 +2,11 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.nagyesta.lowkeyvault.service.certificate.impl.KeyUsageEnum;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.Valid;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
import java.util.Set;
@Data
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyLifetimeActionModel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyLifetimeActionModel.java
index b6b003b4..4badbaec 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyLifetimeActionModel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyLifetimeActionModel.java
@@ -6,11 +6,10 @@
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.github.nagyesta.lowkeyvault.model.v7_3.key.validator.Restore;
import com.github.nagyesta.lowkeyvault.model.v7_3.key.validator.Update;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"trigger", "action"})
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyLifetimeActionTriggerModel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyLifetimeActionTriggerModel.java
index c6cc21ea..bbc6e8ba 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyLifetimeActionTriggerModel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyLifetimeActionTriggerModel.java
@@ -36,8 +36,8 @@ public KeyLifetimeActionTriggerModel(@JsonProperty("timeBeforeExpiry") final Per
}
public KeyLifetimeActionTriggerModel(@NonNull final LifetimeActionTrigger trigger) {
- this.triggerType = trigger.getTriggerType();
- this.triggerPeriod = trigger.getTimePeriod();
+ this.triggerType = trigger.triggerType();
+ this.triggerPeriod = trigger.timePeriod();
}
@JsonGetter
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyLifetimeActionTypeModel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyLifetimeActionTypeModel.java
index 5a662edd..70c3b80c 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyLifetimeActionTypeModel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyLifetimeActionTypeModel.java
@@ -6,11 +6,10 @@
import com.github.nagyesta.lowkeyvault.model.v7_3.key.constants.LifetimeActionType;
import com.github.nagyesta.lowkeyvault.model.v7_3.key.validator.Restore;
import com.github.nagyesta.lowkeyvault.model.v7_3.key.validator.Update;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.NonNull;
-import javax.validation.constraints.NotNull;
-
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class KeyLifetimeActionTypeModel {
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyRotationPolicyAttributes.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyRotationPolicyAttributes.java
index 0cc79008..38ff4aa2 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyRotationPolicyAttributes.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyRotationPolicyAttributes.java
@@ -10,10 +10,10 @@
import com.github.nagyesta.lowkeyvault.model.v7_3.key.validator.ExpiryPeriod;
import com.github.nagyesta.lowkeyvault.model.v7_3.key.validator.Restore;
import com.github.nagyesta.lowkeyvault.model.v7_3.key.validator.Update;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Null;
import lombok.Data;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Null;
import java.time.OffsetDateTime;
import java.time.Period;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyRotationPolicyModel.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyRotationPolicyModel.java
index da6c6874..4b160267 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyRotationPolicyModel.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/KeyRotationPolicyModel.java
@@ -6,11 +6,11 @@
import com.github.nagyesta.lowkeyvault.model.v7_3.key.validator.Restore;
import com.github.nagyesta.lowkeyvault.model.v7_3.key.validator.Update;
import com.github.nagyesta.lowkeyvault.service.key.id.KeyEntityId;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.Data;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
import java.net.URI;
import java.util.List;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/RandomBytesRequest.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/RandomBytesRequest.java
index 38fab756..f8380e7a 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/RandomBytesRequest.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/RandomBytesRequest.java
@@ -2,10 +2,9 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
+import jakarta.validation.constraints.Min;
import lombok.Data;
-import javax.validation.constraints.Min;
-
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RandomBytesRequest {
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/validator/ExpiryPeriod.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/validator/ExpiryPeriod.java
index b68681eb..8fcf2398 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/validator/ExpiryPeriod.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/validator/ExpiryPeriod.java
@@ -1,7 +1,8 @@
package com.github.nagyesta.lowkeyvault.model.v7_3.key.validator;
-import javax.validation.Constraint;
-import javax.validation.Payload;
+import jakarta.validation.Constraint;
+import jakarta.validation.Payload;
+
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/validator/ExpiryPeriodValidator.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/validator/ExpiryPeriodValidator.java
index 2c2e7ef3..453cfb1b 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/validator/ExpiryPeriodValidator.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/model/v7_3/key/validator/ExpiryPeriodValidator.java
@@ -2,9 +2,9 @@
import com.github.nagyesta.lowkeyvault.service.key.constants.LifetimeActionTriggerType;
import com.github.nagyesta.lowkeyvault.service.key.util.PeriodUtil;
+import jakarta.validation.ConstraintValidator;
+import jakarta.validation.ConstraintValidatorContext;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
import java.time.Period;
import java.util.Optional;
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/CertificateLifetimeActionActivity.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/CertificateLifetimeActionActivity.java
index e30f8073..e87b0de8 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/CertificateLifetimeActionActivity.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/CertificateLifetimeActionActivity.java
@@ -1,9 +1,11 @@
package com.github.nagyesta.lowkeyvault.service.certificate;
+import lombok.Getter;
import lombok.NonNull;
import java.util.Arrays;
+@Getter
public enum CertificateLifetimeActionActivity {
/**
* Noop, simulates email notification actions.
@@ -27,7 +29,4 @@ public static CertificateLifetimeActionActivity byValue(@NonNull final String va
.orElseThrow(() -> new IllegalArgumentException("Unknown lifetime action activity: " + value));
}
- public String getValue() {
- return value;
- }
}
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/CertificateLifetimeActionTrigger.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/CertificateLifetimeActionTrigger.java
index 23147663..8f15e2d7 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/CertificateLifetimeActionTrigger.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/CertificateLifetimeActionTrigger.java
@@ -1,17 +1,10 @@
package com.github.nagyesta.lowkeyvault.service.certificate;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
import lombok.NonNull;
import java.time.OffsetDateTime;
-@Getter
-@EqualsAndHashCode
-public class CertificateLifetimeActionTrigger {
-
- private final int value;
- private final CertificateLifetimeActionTriggerType triggerType;
+public record CertificateLifetimeActionTrigger(CertificateLifetimeActionTriggerType triggerType, int value) {
public CertificateLifetimeActionTrigger(
@NonNull final CertificateLifetimeActionTriggerType triggerType, final int value) {
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertAuthorityType.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertAuthorityType.java
index 591cfc27..00f7dc5d 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertAuthorityType.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertAuthorityType.java
@@ -1,9 +1,11 @@
package com.github.nagyesta.lowkeyvault.service.certificate.impl;
import com.github.nagyesta.lowkeyvault.service.certificate.CertificateLifetimeActionActivity;
+import lombok.Getter;
import java.util.Arrays;
+@Getter
public enum CertAuthorityType {
/**
@@ -23,14 +25,6 @@ public enum CertAuthorityType {
this.defaultAction = action;
}
- public String getValue() {
- return value;
- }
-
- public CertificateLifetimeActionActivity getDefaultAction() {
- return defaultAction;
- }
-
public static CertAuthorityType byValue(final String value) {
return Arrays.stream(values())
.filter(c -> c.getValue().equals(value))
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertContentType.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertContentType.java
index b1e20085..27641a34 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertContentType.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertContentType.java
@@ -6,13 +6,13 @@
import com.github.nagyesta.lowkeyvault.model.v7_2.key.request.JsonWebKeyImportRequest;
import com.github.nagyesta.lowkeyvault.service.exception.CryptoException;
import com.github.nagyesta.lowkeyvault.service.key.util.KeyGenUtil;
+import lombok.Getter;
import lombok.NonNull;
import org.apache.tomcat.util.codec.binary.Base64;
import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey;
import org.bouncycastle.openssl.jcajce.JcaPEMWriter;
import org.bouncycastle.openssl.jcajce.JcaPKCS8Generator;
import org.springframework.util.Assert;
-import org.springframework.util.Base64Utils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -31,6 +31,7 @@
import static com.github.nagyesta.lowkeyvault.model.v7_2.key.constants.KeyType.EC;
import static com.github.nagyesta.lowkeyvault.model.v7_2.key.constants.KeyType.RSA;
+@Getter
public enum CertContentType {
/**
@@ -71,7 +72,7 @@ public JsonWebKeyImportRequest getKey(@NonNull final String certificateContent,
public String asBase64CertificatePackage(@NonNull final Certificate certificate,
@NonNull final KeyPair keyPair) throws CryptoException {
final byte[] bytes = generateCertificatePackage(certificate, keyPair, DEFAULT_PASSWORD);
- return Base64Utils.encodeToString(bytes);
+ return new Base64().encodeAsString(bytes);
}
@Override
@@ -218,10 +219,6 @@ private static KeyType assumeKeyType(final int size) {
this.mimeType = mimeType;
}
- public String getMimeType() {
- return mimeType;
- }
-
public static CertContentType byMimeType(final String mimeType) {
return Arrays.stream(values())
.filter(c -> c.getMimeType().equals(mimeType))
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertificateAlgorithm.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertificateAlgorithm.java
index 8290f8ad..73fc909b 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertificateAlgorithm.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertificateAlgorithm.java
@@ -1,12 +1,14 @@
package com.github.nagyesta.lowkeyvault.service.certificate.impl;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.constants.KeyType;
+import lombok.Getter;
import lombok.NonNull;
import java.util.Arrays;
import java.util.Optional;
import java.util.Set;
+@SuppressWarnings("LombokGetterMayBeUsed")
public enum CertificateAlgorithm {
/**
@@ -18,6 +20,7 @@ public enum CertificateAlgorithm {
*/
EC("SHA256withECDSA", Set.of(KeyType.EC, KeyType.EC_HSM));
+ @Getter
private final String algorithm;
private final Set keyTypes;
@@ -26,10 +29,6 @@ public enum CertificateAlgorithm {
this.keyTypes = keyTypes;
}
- public String getAlgorithm() {
- return algorithm;
- }
-
public static CertificateAlgorithm forKeyType(@NonNull final KeyType keyType) {
final Optional value = Arrays.stream(CertificateAlgorithm.values())
.filter(v -> v.keyTypes.contains(keyType))
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertificateGenerator.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertificateGenerator.java
index b549bea5..f57ffc80 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertificateGenerator.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/certificate/impl/CertificateGenerator.java
@@ -44,7 +44,6 @@
public class CertificateGenerator {
private static final int NUMBER_OF_BITS_SERIAL = 160;
- private static final int NUMBER_OF_BYTES_CID = 20;
private final VaultFake vault;
private final VersionedKeyEntityId kid;
private final SecureRandom secureRandom = new SecureRandom();
@@ -123,7 +122,7 @@ private ExtendedKeyUsage convertUsageExtensions(final ReadOnlyCertificatePolicy
.stream()
.map(ASN1ObjectIdentifier::new)
.map(KeyPurposeId::getInstance)
- .collect(Collectors.toList())
+ .toList()
.toArray(new KeyPurposeId[]{}));
}
return result;
@@ -180,7 +179,7 @@ private GeneralName[] generateSubjectAlternativeNamesArray(final ReadOnlyCertifi
.collect(Collectors.toList());
final List subjectAlternativeNames = Stream.of(emails, dnsNames, ips)
.flatMap(List::stream)
- .collect(Collectors.toList());
+ .toList();
return subjectAlternativeNames.toArray(new GeneralName[]{});
}
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/common/impl/ConcurrentVersionedEntityMultiMap.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/common/impl/ConcurrentVersionedEntityMultiMap.java
index 46f1f6d9..1289ff21 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/common/impl/ConcurrentVersionedEntityMultiMap.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/common/impl/ConcurrentVersionedEntityMultiMap.java
@@ -146,7 +146,7 @@ public void purgeExpired() {
final List purgeable = entities.entrySet().stream()
.filter(e -> e.getValue().values().stream().anyMatch(ME::isPurgeExpired))
.map(Map.Entry::getKey)
- .collect(Collectors.toList());
+ .toList();
purgeable.forEach(key -> {
entities.remove(key);
versions.remove(key);
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/common/impl/KeyVaultLifecycleAwareEntity.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/common/impl/KeyVaultLifecycleAwareEntity.java
index c4f12100..d11ecf07 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/common/impl/KeyVaultLifecycleAwareEntity.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/common/impl/KeyVaultLifecycleAwareEntity.java
@@ -1,5 +1,6 @@
package com.github.nagyesta.lowkeyvault.service.common.impl;
+import lombok.Getter;
import org.springframework.lang.NonNull;
import org.springframework.util.Assert;
@@ -7,6 +8,7 @@
import java.time.ZoneOffset;
import java.util.Optional;
+@Getter
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
public class KeyVaultLifecycleAwareEntity {
private OffsetDateTime created;
@@ -23,38 +25,18 @@ protected KeyVaultLifecycleAwareEntity() {
this.expiry = Optional.empty();
}
- public boolean isEnabled() {
- return enabled;
- }
-
public void setEnabled(final boolean enabled) {
this.enabled = enabled;
}
- public Optional getNotBefore() {
- return notBefore;
- }
-
public void setNotBefore(final OffsetDateTime notBefore) {
this.notBefore = Optional.ofNullable(notBefore);
}
- public Optional getExpiry() {
- return expiry;
- }
-
public void setExpiry(final OffsetDateTime expiry) {
this.expiry = Optional.ofNullable(expiry);
}
- public OffsetDateTime getCreated() {
- return created;
- }
-
- public OffsetDateTime getUpdated() {
- return updated;
- }
-
public void timeShift(final int offsetSeconds) {
Assert.isTrue(offsetSeconds > 0, "Offset must be positive.");
created = created.minusSeconds(offsetSeconds);
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/KeyLifetimeAction.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/KeyLifetimeAction.java
index 5fc25091..93d493d6 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/KeyLifetimeAction.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/KeyLifetimeAction.java
@@ -3,23 +3,10 @@
import com.github.nagyesta.lowkeyvault.model.v7_3.key.constants.LifetimeActionType;
import lombok.NonNull;
-public class KeyLifetimeAction implements LifetimeAction {
-
- private final LifetimeActionType actionType;
- private final LifetimeActionTrigger trigger;
+public record KeyLifetimeAction(LifetimeActionType actionType, LifetimeActionTrigger trigger) implements LifetimeAction {
public KeyLifetimeAction(@NonNull final LifetimeActionType actionType, @NonNull final LifetimeActionTrigger trigger) {
this.actionType = actionType;
this.trigger = trigger;
}
-
- @Override
- public LifetimeActionType getActionType() {
- return actionType;
- }
-
- @Override
- public LifetimeActionTrigger getTrigger() {
- return trigger;
- }
}
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/LifetimeAction.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/LifetimeAction.java
index 074e59a2..e568b6e3 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/LifetimeAction.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/LifetimeAction.java
@@ -4,7 +4,7 @@
public interface LifetimeAction {
- LifetimeActionType getActionType();
+ LifetimeActionType actionType();
- LifetimeActionTrigger getTrigger();
+ LifetimeActionTrigger trigger();
}
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/LifetimeActionTrigger.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/LifetimeActionTrigger.java
index 46e57519..a9aaf210 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/LifetimeActionTrigger.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/LifetimeActionTrigger.java
@@ -7,9 +7,9 @@
public interface LifetimeActionTrigger {
- Period getTimePeriod();
+ Period timePeriod();
- LifetimeActionTriggerType getTriggerType();
+ LifetimeActionTriggerType triggerType();
boolean shouldTrigger(OffsetDateTime created, OffsetDateTime expiry);
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/EcKeyVaultKeyEntity.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/EcKeyVaultKeyEntity.java
index 01bfb04f..9613ab1f 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/EcKeyVaultKeyEntity.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/EcKeyVaultKeyEntity.java
@@ -3,6 +3,7 @@
import com.github.nagyesta.lowkeyvault.model.v7_2.key.constants.*;
import com.github.nagyesta.lowkeyvault.service.key.ReadOnlyEcKeyVaultKeyEntity;
import com.github.nagyesta.lowkeyvault.service.key.id.VersionedKeyEntityId;
+import com.github.nagyesta.lowkeyvault.service.key.util.Asn1ConverterUtil;
import com.github.nagyesta.lowkeyvault.service.vault.VaultFake;
import lombok.extern.slf4j.Slf4j;
import org.springframework.lang.NonNull;
@@ -100,4 +101,14 @@ public boolean verifySignedBytes(final byte[] digest,
final Callable verifyCallable = verifyCallable(digest, signatureAlgorithm, signature, getKey().getPublic());
return doCrypto(verifyCallable, "Cannot verify digest message.", log);
}
+
+ @Override
+ protected byte[] postProcessGeneratedSignature(final byte[] signature) throws Exception {
+ return Asn1ConverterUtil.convertFromAsn1toRaw(signature, getKeyCurveName().getByteLength());
+ }
+
+ @Override
+ protected byte[] preProcessVerifiableSignature(final byte[] rawSignature) throws Exception {
+ return Asn1ConverterUtil.convertFromRawToAsn1(rawSignature);
+ }
}
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/KeyLifetimeActionTrigger.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/KeyLifetimeActionTrigger.java
index c13a6386..cdddc6e4 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/KeyLifetimeActionTrigger.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/KeyLifetimeActionTrigger.java
@@ -8,26 +8,13 @@
import java.time.OffsetDateTime;
import java.time.Period;
-public class KeyLifetimeActionTrigger implements LifetimeActionTrigger {
-
- private final Period timePeriod;
- private final LifetimeActionTriggerType triggerType;
+public record KeyLifetimeActionTrigger(Period timePeriod, LifetimeActionTriggerType triggerType) implements LifetimeActionTrigger {
public KeyLifetimeActionTrigger(@NonNull final Period timePeriod, @NonNull final LifetimeActionTriggerType triggerType) {
this.timePeriod = timePeriod;
this.triggerType = triggerType;
}
- @Override
- public Period getTimePeriod() {
- return timePeriod;
- }
-
- @Override
- public LifetimeActionTriggerType getTriggerType() {
- return triggerType;
- }
-
@Override
public boolean shouldTrigger(final OffsetDateTime created, final OffsetDateTime expiry) {
return triggerType.shouldTrigger(created, expiry, timePeriod);
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/KeyRotationPolicy.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/KeyRotationPolicy.java
index ad40f376..0d3b2e2a 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/KeyRotationPolicy.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/KeyRotationPolicy.java
@@ -40,7 +40,7 @@ public boolean isAutoRotate() {
@Override
public List missedRotations(@NonNull final OffsetDateTime keyCreation) {
Assert.isTrue(isAutoRotate(), "Cannot have missed rotations without a \"rotate\" lifetime action.");
- final LifetimeActionTrigger trigger = lifetimeActions.get(LifetimeActionType.ROTATE).getTrigger();
+ final LifetimeActionTrigger trigger = lifetimeActions.get(LifetimeActionType.ROTATE).trigger();
final OffsetDateTime startPoint = findTriggerTimeOffset(keyCreation, s -> trigger.rotateAfterDays(expiryTime));
return collectMissedTriggerDays(s -> trigger.rotateAfterDays(expiryTime), startPoint);
}
@@ -53,10 +53,10 @@ public Map getLifetimeActions() {
@Override
public void validate(final OffsetDateTime latestKeyVersionExpiry) {
lifetimeActions.values().forEach(action -> {
- final Period triggerPeriod = action.getTrigger().getTimePeriod();
- final LifetimeActionTriggerType triggerType = action.getTrigger().getTriggerType();
+ final Period triggerPeriod = action.trigger().timePeriod();
+ final LifetimeActionTriggerType triggerType = action.trigger().triggerType();
triggerType.validate(latestKeyVersionExpiry, expiryTime, triggerPeriod);
- Assert.isTrue(action.getActionType() != LifetimeActionType.NOTIFY
+ Assert.isTrue(action.actionType() != LifetimeActionType.NOTIFY
|| triggerType == LifetimeActionTriggerType.TIME_BEFORE_EXPIRY,
"Notify actions cannot be used with time after creation trigger.");
});
diff --git a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/KeyVaultKeyEntity.java b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/KeyVaultKeyEntity.java
index fdd9c3db..b9fbce56 100644
--- a/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/KeyVaultKeyEntity.java
+++ b/lowkey-vault-app/src/main/java/com/github/nagyesta/lowkeyvault/service/key/impl/KeyVaultKeyEntity.java
@@ -7,6 +7,7 @@
import com.github.nagyesta.lowkeyvault.service.key.ReadOnlyKeyVaultKeyEntity;
import com.github.nagyesta.lowkeyvault.service.key.id.VersionedKeyEntityId;
import com.github.nagyesta.lowkeyvault.service.vault.VaultFake;
+import lombok.Getter;
import lombok.NonNull;
import org.slf4j.Logger;
import org.springframework.util.Assert;
@@ -17,7 +18,6 @@
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
-import java.util.stream.Collectors;
/**
* Common Key entity base class.
@@ -25,8 +25,10 @@
* @param The type of the key.
* @param The type of the key parameter.
*/
+@SuppressWarnings("LombokGetterMayBeUsed")
public abstract class KeyVaultKeyEntity extends KeyVaultBaseEntity implements ReadOnlyKeyVaultKeyEntity {
+ @Getter
private final T key;
private final S keyParam;
private final boolean hsm;
@@ -46,10 +48,6 @@ protected KeyVaultKeyEntity(@NonNull final VersionedKeyEntityId id,
this.operations = Collections.emptyList();
}
- public T getKey() {
- return key;
- }
-
protected S getKeyParam() {
return keyParam;
}
@@ -69,7 +67,7 @@ public List