dbeaver/pro#7082 use same ws connection after relogin fix (#3803)

This commit is contained in:
Ainur
2025-10-09 10:52:07 +02:00
committed by GitHub
parent 683d85c8d6
commit ec1b455f4d
3 changed files with 5 additions and 15 deletions
@@ -29,8 +29,8 @@ import org.jkiss.dbeaver.model.auth.SMAuthSpace;
import org.jkiss.dbeaver.model.auth.SMSessionContext;
import org.jkiss.dbeaver.model.auth.impl.AbstractSessionPersistent;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.security.user.SMTeam;
import org.jkiss.dbeaver.model.rm.RMProjectInfo;
import org.jkiss.dbeaver.model.security.user.SMTeam;
import org.jkiss.dbeaver.model.websocket.event.WSEvent;
import org.jkiss.dbeaver.model.websocket.event.WSEventDeleteTempFile;
import org.jkiss.dbeaver.model.websocket.event.session.WSSessionExpiredEvent;
@@ -793,7 +793,7 @@ public class WebSession extends BaseWebSession
}
}
public List<WebAuthInfo> removeAuthInfo(String providerId, boolean needResetUserState) throws DBException {
public List<WebAuthInfo> removeAuthInfo(String providerId) throws DBException {
List<WebAuthInfo> oldInfo;
if (providerId == null) {
oldInfo = clearAuthTokens();
@@ -806,16 +806,12 @@ public class WebSession extends BaseWebSession
oldInfo = List.of();
}
}
if (authTokens.isEmpty() && needResetUserState) {
if (authTokens.isEmpty()) {
resetUserState();
}
return oldInfo;
}
public List<WebAuthInfo> removeAuthInfo(String providerId) throws DBException {
return removeAuthInfo(providerId, true);
}
public List<DBACredentialsProvider> getContextCredentialsProviders() {
return getAdapters(DBACredentialsProvider.class);
}
@@ -224,10 +224,8 @@ public class WebServiceAuthImpl implements DBWServiceAuth {
throw new DBWebException("Not logged in");
}
try {
List<WebAuthInfo> removedInfos = webSession.removeAuthInfo(providerId, false);
List<WebAuthInfo> removedInfos = webSession.removeAuthInfo(providerId);
var cbApp = CBApplication.getInstance();
cbApp.getSessionManager().closeSession(webSession.getSessionId(), false);
webSession.resetUserState();
List<String> logoutUrls = new ArrayList<>();
String origin = ServletAppUtils.getOriginFromRequest(httpRequest);
@@ -268,11 +266,7 @@ public class WebServiceAuthImpl implements DBWServiceAuth {
public WebUserInfo activeUser(@NotNull WebSession webSession) throws DBWebException {
if (webSession.getUser() == null) {
ServletApplication application = webSession.getApplication();
if (application.getAppConfiguration().isAnonymousAccessEnabled() && webSession.isAuthorizedInSecurityManager()) {
SMUser anonymous = new SMUser("anonymous", true, null);
return new WebUserInfo(webSession, new WebUser(anonymous));
}
if (!application.isAnonymousAccessEnabled()) {
if (!application.getAppConfiguration().isAnonymousAccessEnabled() || !webSession.isAuthorizedInSecurityManager()) {
return null;
}
SMUser anonymous = new SMUser("anonymous", true, null);