From 6965284662ad473c0124cc73ee083be78b64974f Mon Sep 17 00:00:00 2001 From: "denis.sinelnikov" Date: Tue, 17 Dec 2024 12:02:39 +0100 Subject: [PATCH] CB-5807. Revert --- .../service/auth/DBWServiceAuth.java | 2 +- .../service/auth/WebServiceBindingAuth.java | 2 +- .../service/auth/impl/WebServiceAuthImpl.java | 4 +- .../user/WebAuthCredentialsProfileInfo.java | 50 ------------------- .../auth/model/user/WebAuthProviderInfo.java | 4 +- .../plugin.xml | 4 +- 6 files changed, 7 insertions(+), 59 deletions(-) delete mode 100644 server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/model/user/WebAuthCredentialsProfileInfo.java diff --git a/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/DBWServiceAuth.java b/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/DBWServiceAuth.java index a4c6fdca2a..12d1266369 100644 --- a/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/DBWServiceAuth.java +++ b/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/DBWServiceAuth.java @@ -56,7 +56,7 @@ WebLogoutInfo authLogout( WebUserInfo activeUser(@NotNull WebSession webSession) throws DBWebException; @WebAction(authRequired = false) - WebAuthProviderInfo[] getAuthProviders(WebSession webSession); + WebAuthProviderInfo[] getAuthProviders(); @WebAction() boolean changeLocalPassword(@NotNull WebSession webSession, @NotNull String oldPassword, @NotNull String newPassword) throws DBWebException; diff --git a/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/WebServiceBindingAuth.java b/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/WebServiceBindingAuth.java index 373198ffea..7c01c9610c 100644 --- a/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/WebServiceBindingAuth.java +++ b/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/WebServiceBindingAuth.java @@ -61,7 +61,7 @@ public void bindWiring(DBWBindingContext model) throws DBWebException { CommonUtils.toBoolean(env.getArgument("linkUser")) )) .dataFetcher("activeUser", env -> getService(env).activeUser(getWebSession(env, false))) - .dataFetcher("authProviders", env -> getService(env).getAuthProviders(getWebSession(env))) + .dataFetcher("authProviders", env -> getService(env).getAuthProviders()) .dataFetcher("authChangeLocalPassword", env -> getService(env).changeLocalPassword( getWebSession(env), env.getArgument("oldPassword"), diff --git a/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/impl/WebServiceAuthImpl.java b/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/impl/WebServiceAuthImpl.java index 479be5eeef..e8e008afba 100644 --- a/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/impl/WebServiceAuthImpl.java +++ b/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/impl/WebServiceAuthImpl.java @@ -222,9 +222,9 @@ public WebUserInfo activeUser(@NotNull WebSession webSession) throws DBWebExcept } @Override - public WebAuthProviderInfo[] getAuthProviders(WebSession webSession) { + public WebAuthProviderInfo[] getAuthProviders() { return WebAuthProviderRegistry.getInstance().getAuthProviders() - .stream().map(p -> new WebAuthProviderInfo(webSession, p)) + .stream().map(WebAuthProviderInfo::new) .toArray(WebAuthProviderInfo[]::new); } diff --git a/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/model/user/WebAuthCredentialsProfileInfo.java b/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/model/user/WebAuthCredentialsProfileInfo.java deleted file mode 100644 index 33e9e46715..0000000000 --- a/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/model/user/WebAuthCredentialsProfileInfo.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * DBeaver - Universal Database Manager - * Copyright (C) 2010-2024 DBeaver Corp and others - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.cloudbeaver.service.auth.model.user; - -import io.cloudbeaver.model.WebPropertyInfo; -import io.cloudbeaver.model.session.WebSession; -import io.cloudbeaver.registry.WebAuthProviderDescriptor; -import org.jkiss.dbeaver.model.security.SMAuthCredentialsProfile; - -import java.util.List; - -public class WebAuthCredentialsProfileInfo { - private final SMAuthCredentialsProfile profile; - private final WebSession webSession; - - public WebAuthCredentialsProfileInfo(WebSession webSession, SMAuthCredentialsProfile profile) { - this.profile = profile; - this.webSession = webSession; - } - - public String getId() { - return profile.getId(); - } - - public String getLabel() { - return profile.getLabel(); - } - - public String getDescription() { - return profile.getDescription(); - } - - public List getCredentialParameters() { - return profile.getCredentialParameters().stream().map(p -> new WebPropertyInfo(webSession, p)).toList(); - } -} diff --git a/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/model/user/WebAuthProviderInfo.java b/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/model/user/WebAuthProviderInfo.java index 9b0e181e23..7919d5b7b1 100644 --- a/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/model/user/WebAuthProviderInfo.java +++ b/server/bundles/io.cloudbeaver.service.auth/src/io/cloudbeaver/service/auth/model/user/WebAuthProviderInfo.java @@ -40,11 +40,9 @@ public class WebAuthProviderInfo { private static final Log log = Log.getLog(WebAuthProviderInfo.class); private final WebAuthProviderDescriptor descriptor; - private final WebSession webSession; - public WebAuthProviderInfo(WebSession webSession, WebAuthProviderDescriptor descriptor) { + public WebAuthProviderInfo(WebAuthProviderDescriptor descriptor) { this.descriptor = descriptor; - this.webSession = webSession; } WebAuthProviderDescriptor getDescriptor() { diff --git a/server/bundles/io.cloudbeaver.service.ldap.auth/plugin.xml b/server/bundles/io.cloudbeaver.service.ldap.auth/plugin.xml index c5c4b6bccb..18e0023dab 100644 --- a/server/bundles/io.cloudbeaver.service.ldap.auth/plugin.xml +++ b/server/bundles/io.cloudbeaver.service.ldap.auth/plugin.xml @@ -31,8 +31,8 @@ - - +