Solve conflicts.

This commit is contained in:
KomachiSion 2022-01-12 17:02:20 +08:00
parent 78de31dbdd
commit 4e98013f8e
8 changed files with 25 additions and 13 deletions

View File

@ -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.
#

View File

@ -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);
}

View File

@ -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.

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;