From fc855822a88513bdc94659d2eb74b4f39d60b779 Mon Sep 17 00:00:00 2001 From: Aleksandr Skoblikov Date: Tue, 20 Feb 2024 22:41:39 +0400 Subject: [PATCH] complex secret id --- .../src/io/cloudbeaver/model/WebSecretInfo.java | 7 ++++++- .../io/cloudbeaver/service/core/impl/WebServiceCore.java | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebSecretInfo.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebSecretInfo.java index ee412bde07..d070a02477 100644 --- a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebSecretInfo.java +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebSecretInfo.java @@ -16,6 +16,7 @@ */ package io.cloudbeaver.model; +import org.jkiss.code.NotNull; import org.jkiss.dbeaver.model.meta.Property; import org.jkiss.dbeaver.model.secret.DBSSecretValue; @@ -33,6 +34,10 @@ public String getDisplayName() { @Property public String getSecretId() { - return secretValue.getSubjectId(); + return buildComplexSecretId(secretValue); + } + + public static String buildComplexSecretId(@NotNull DBSSecretValue secretValue) { + return secretValue.getId() + "_" + secretValue.getSubjectId(); } } diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/core/impl/WebServiceCore.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/core/impl/WebServiceCore.java index e814113d04..f50368a1e8 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/core/impl/WebServiceCore.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/core/impl/WebServiceCore.java @@ -338,7 +338,7 @@ public WebConnectionInfo initConnection( } DBSSecretValue selectedSecret = allSecrets.stream() - .filter(secret -> selectedSecretId.equals(secret.getSubjectId())) + .filter(secret -> selectedSecretId.equals(WebSecretInfo.buildComplexSecretId(secret))) .findFirst().orElse(null); if (selectedSecret == null) { throw new DBWebException("Secret not found:" + selectedSecretId);