mirror of
https://github.com/DerDavidBohl/dirigent-spring.git
synced 2025-12-30 16:12:13 -06:00
Added Secret Deletion
This commit is contained in:
@@ -2,6 +2,7 @@ package org.davidbohl.dirigent.sercrets;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
@@ -28,6 +29,11 @@ public class SecretController {
|
||||
this.secretService.saveSecret(key, secret.environmentVariable(), secret.value(), secret.deployments());
|
||||
}
|
||||
|
||||
@DeleteMapping("{key}")
|
||||
public void deleteSecret(@PathVariable String key) {
|
||||
this.secretService.deleteSecret(key);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public List<SecretDto> getSecrets() {
|
||||
return this.secretService.getAllSecretsWithoutValues();
|
||||
|
||||
@@ -66,6 +66,10 @@ public class SecretService {
|
||||
).toList();
|
||||
}
|
||||
|
||||
public void deleteSecret(String key) {
|
||||
secretRepository.deleteById(key);
|
||||
}
|
||||
|
||||
private String encrypt(String value) throws Exception {
|
||||
SecretKeySpec keySpec = new SecretKeySpec(encryptionKey.getBytes(), ALGORITHM);
|
||||
Cipher cipher = Cipher.getInstance(ALGORITHM);
|
||||
|
||||
Reference in New Issue
Block a user