From 930a8c14d936acf37b86efc97907171eef8a2f37 Mon Sep 17 00:00:00 2001 From: Aleksandr Skoblikov Date: Fri, 25 Oct 2024 13:29:31 +0400 Subject: [PATCH] dbeaver/pro#3465 udbt reconnect improve --- .../cloudbeaver/service/session/WebSessionManager.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/session/WebSessionManager.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/session/WebSessionManager.java index 92017155d1..324c96de6d 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/session/WebSessionManager.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/session/WebSessionManager.java @@ -18,10 +18,10 @@ import io.cloudbeaver.DBWebException; import io.cloudbeaver.auth.SMTokenCredentialProvider; -import io.cloudbeaver.server.AppWebSessionManager; import io.cloudbeaver.model.session.*; import io.cloudbeaver.registry.WebHandlerRegistry; import io.cloudbeaver.registry.WebSessionHandlerDescriptor; +import io.cloudbeaver.server.AppWebSessionManager; import io.cloudbeaver.server.CBApplication; import io.cloudbeaver.server.CBConstants; import io.cloudbeaver.server.events.WSWebUtils; @@ -315,6 +315,14 @@ public WebHeadlessSession getHeadlessSession(Request request, Session session, b var existSession = sessionMap.get(sessionId); if (existSession instanceof WebHeadlessSession) { + var creds = existSession.getUserContext().getActiveUserCredentials(); + if (creds == null || !smAccessToken.equals(creds.getSmAccessToken())) { + existSession.getUserContext().refresh( + smAccessToken, + null, + authPermissions + ); + } return (WebHeadlessSession) existSession; } if (existSession != null) {