Fix secret cache

This commit is contained in:
crschnick committed 2026-10-02 09:22:15 +00:00
1 parent 977b349118
commit 79841ee594
4 files changed
+15 -7

No files matched your search

@@ -49,7 +49,8 @@ public class StoreCreationModel {
boolean staticDisplay;
StoreCreationConsumer consumer;
ObservableBooleanValue syncable;
UUID uuid;
UUID newEntryUuid;
UUID cacheTargetUuid;
String defaultName;
public StoreCreationModel(
@@ -74,9 +75,10 @@ public class StoreCreationModel {
: null;
this.staticDisplay = staticDisplay;
this.consumer = consumer;
this.uuid = existingEntry != null && !DataStorage.get().getEffectiveReadOnlyState(existingEntry)
this.newEntryUuid = UUID.randomUUID();
this.cacheTargetUuid = existingEntry != null && !DataStorage.get().getEffectiveReadOnlyState(existingEntry)
? existingEntry.getUuid()
: UUID.randomUUID();
: newEntryUuid;
this.provider.addListener((c, o, n) -> {
store.unbind();
@@ -107,12 +109,12 @@ public class StoreCreationModel {
}
var initial = DataStoreEntry.createNew(
uuid, DataStorage.get().getSelectedCategory().getUuid(), effectiveName, store.getValue());
newEntryUuid, DataStorage.get().getSelectedCategory().getUuid(), effectiveName, store.getValue());
var entryRef = existingEntry != null
? existingEntry
: DataStorage.get().getDefaultDisplayParent(initial).orElse(initial);
var targetCategory = getTargetCategory(entryRef.getCategoryUuid());
var e = DataStoreEntry.createNew(uuid, targetCategory.getUuid(), effectiveName, store.getValue());
var e = DataStoreEntry.createNew(newEntryUuid, targetCategory.getUuid(), effectiveName, store.getValue());
if (!store.getValue().equals(e.getStore())) {
ErrorEventFactory.fromMessage("Store serialization mismatch")
@@ -123,6 +123,10 @@ public class SecretManager {
}
public static synchronized void moveReferences(UUID oldId, UUID newId) {
if (oldId.equals(newId)) {
return;
}
var oldSecrets = secrets.entrySet().stream()
.filter(e -> e.getKey().getSecretId().equals(oldId))
.collect(Collectors.toSet());
@@ -56,12 +56,12 @@ public interface SecretQuery {
@Override
public Duration cacheDuration() {
return null;
return original.cacheDuration();
}
@Override
public boolean retryOnFail() {
return true;
return original.retryOnFail();
}
@Override
@@ -476,9 +476,11 @@ public abstract class DataStorage {
for (DataStoreEntry other : otherToFinalize) {
other.finalizeEntry();
SecretManager.clearAll(other.getUuid());
}
entry.finalizeEntry();
SecretManager.clearAll(entry.getUuid());
}
public Set<DataStoreEntryRef<?>> getDependencies(DataStoreEntry entry) {