diff --git a/auth/src/main/resources/META-INF/services/com.alibaba.nacos.auth.AuthService b/auth/src/main/resources/META-INF/services/com.alibaba.nacos.auth.AuthService index e69de29bb..229046941 100644 --- a/auth/src/main/resources/META-INF/services/com.alibaba.nacos.auth.AuthService +++ b/auth/src/main/resources/META-INF/services/com.alibaba.nacos.auth.AuthService @@ -0,0 +1,16 @@ +# +# Copyright 1999-2021 Alibaba Group Holding Ltd. +# +# 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. +# + diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingMaintainService.java b/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingMaintainService.java index c7d9307a2..f220673ce 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingMaintainService.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/NacosNamingMaintainService.java @@ -79,19 +79,19 @@ public class NacosNamingMaintainService implements NamingMaintainService { serverListManager = new ServerListManager(properties, namespace); securityProxy = new SecurityProxy(serverListManager.getServerList(), NamingHttpClientManager.getInstance().getNacosRestTemplate()); - initSecurityProxy(); + initSecurityProxy(properties); serverProxy = new NamingHttpClientProxy(namespace, securityProxy, serverListManager, properties, null); } - private void initSecurityProxy() { + private void initSecurityProxy(Properties properties) { this.executorService = new ScheduledThreadPoolExecutor(1, r -> { Thread t = new Thread(r); t.setName("com.alibaba.nacos.client.naming.maintainService.security"); t.setDaemon(true); return t; }); - this.securityProxy.login(serverListManager.getServerList()); - this.executorService.scheduleWithFixedDelay(() -> securityProxy.login(serverListManager.getServerList()), 0, + this.securityProxy.login(properties); + this.executorService.scheduleWithFixedDelay(() -> securityProxy.login(properties), 0, SECURITY_INFO_REFRESH_INTERVAL_MILLS, TimeUnit.MILLISECONDS); } diff --git a/client/src/main/java/com/alibaba/nacos/client/security/SecurityProxy.java b/client/src/main/java/com/alibaba/nacos/client/security/SecurityProxy.java index e77db3394..509f989b6 100644 --- a/client/src/main/java/com/alibaba/nacos/client/security/SecurityProxy.java +++ b/client/src/main/java/com/alibaba/nacos/client/security/SecurityProxy.java @@ -41,6 +41,7 @@ public class SecurityProxy implements Closeable { /** * Construct from serverList, nacosRestTemplate, init client auth plugin. + * // TODO change server list to serverListManager after serverListManager refactor and unite. * * @param serverList a server list that client request to. * @Param nacosRestTemplate http request template. diff --git a/config/src/main/java/com/alibaba/nacos/config/server/auth/ConfigResourceParser.java b/config/src/main/java/com/alibaba/nacos/config/server/auth/ConfigResourceParser.java index 7239992a5..de3b4d269 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/auth/ConfigResourceParser.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/auth/ConfigResourceParser.java @@ -19,10 +19,9 @@ package com.alibaba.nacos.config.server.auth; import com.alibaba.nacos.api.config.remote.request.ConfigBatchListenRequest; import com.alibaba.nacos.api.remote.request.Request; import com.alibaba.nacos.auth.constant.Constants; -import com.alibaba.nacos.auth.model.Resource; import com.alibaba.nacos.auth.parser.ResourceParser; -import com.alibaba.nacos.common.utils.ReflectUtils; import com.alibaba.nacos.common.utils.NamespaceUtil; +import com.alibaba.nacos.common.utils.ReflectUtils; import com.alibaba.nacos.common.utils.StringUtils; import javax.servlet.http.HttpServletRequest; diff --git a/console/src/main/java/com/alibaba/nacos/console/controller/UserController.java b/console/src/main/java/com/alibaba/nacos/console/controller/UserController.java index 37d3556ab..c444d7d60 100644 --- a/console/src/main/java/com/alibaba/nacos/console/controller/UserController.java +++ b/console/src/main/java/com/alibaba/nacos/console/controller/UserController.java @@ -29,7 +29,6 @@ import com.alibaba.nacos.config.server.auth.RoleInfo; import com.alibaba.nacos.config.server.model.User; import com.alibaba.nacos.config.server.utils.RequestUtil; import com.alibaba.nacos.console.security.nacos.JwtTokenManager; -import com.alibaba.nacos.console.security.nacos.NacosAuthConfig; import com.alibaba.nacos.console.security.nacos.NacosAuthManager; import com.alibaba.nacos.console.security.nacos.constant.AuthConstants; import com.alibaba.nacos.console.security.nacos.roles.NacosRoleServiceImpl; diff --git a/console/src/main/java/com/alibaba/nacos/console/security/nacos/filter/JwtAuthenticationTokenFilter.java b/console/src/main/java/com/alibaba/nacos/console/security/nacos/filter/JwtAuthenticationTokenFilter.java index 3180b6227..cc50f245a 100644 --- a/console/src/main/java/com/alibaba/nacos/console/security/nacos/filter/JwtAuthenticationTokenFilter.java +++ b/console/src/main/java/com/alibaba/nacos/console/security/nacos/filter/JwtAuthenticationTokenFilter.java @@ -19,7 +19,6 @@ package com.alibaba.nacos.console.security.nacos.filter; import com.alibaba.nacos.api.common.Constants; import com.alibaba.nacos.common.utils.StringUtils; import com.alibaba.nacos.console.security.nacos.JwtTokenManager; -import com.alibaba.nacos.console.security.nacos.NacosAuthConfig; import com.alibaba.nacos.console.security.nacos.constant.AuthConstants; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; diff --git a/console/src/main/java/com/alibaba/nacos/console/security/nacos/roles/NacosRoleServiceImpl.java b/console/src/main/java/com/alibaba/nacos/console/security/nacos/roles/NacosRoleServiceImpl.java index e4064e544..1c8525a89 100644 --- a/console/src/main/java/com/alibaba/nacos/console/security/nacos/roles/NacosRoleServiceImpl.java +++ b/console/src/main/java/com/alibaba/nacos/console/security/nacos/roles/NacosRoleServiceImpl.java @@ -24,7 +24,6 @@ import com.alibaba.nacos.config.server.auth.PermissionPersistService; import com.alibaba.nacos.config.server.auth.RoleInfo; import com.alibaba.nacos.config.server.auth.RolePersistService; import com.alibaba.nacos.config.server.model.Page; -import com.alibaba.nacos.console.security.nacos.NacosAuthConfig; import com.alibaba.nacos.console.security.nacos.constant.AuthConstants; import com.alibaba.nacos.console.security.nacos.users.NacosUserDetailsServiceImpl; import com.alibaba.nacos.core.utils.Loggers; diff --git a/naming/src/main/java/com/alibaba/nacos/naming/web/NamingResourceParser.java b/naming/src/main/java/com/alibaba/nacos/naming/web/NamingResourceParser.java index 47a8aeec0..ff0010c13 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/web/NamingResourceParser.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/web/NamingResourceParser.java @@ -21,12 +21,11 @@ import com.alibaba.nacos.api.naming.remote.request.AbstractNamingRequest; import com.alibaba.nacos.api.naming.utils.NamingUtils; import com.alibaba.nacos.api.remote.request.Request; import com.alibaba.nacos.auth.constant.Constants; -import com.alibaba.nacos.auth.model.Resource; import com.alibaba.nacos.auth.parser.ResourceParser; -import com.alibaba.nacos.common.utils.ReflectUtils; import com.alibaba.nacos.common.utils.NamespaceUtil; -import com.alibaba.nacos.naming.constants.FieldsConstants; +import com.alibaba.nacos.common.utils.ReflectUtils; import com.alibaba.nacos.common.utils.StringUtils; +import com.alibaba.nacos.naming.constants.FieldsConstants; import javax.servlet.http.HttpServletRequest; @@ -42,7 +41,7 @@ public class NamingResourceParser implements ResourceParser { @Override public String parseName(Object requestObj) { - + String namespaceId = null; String serviceName = null; String groupName = null;