fix batchRegister authentication (#9899)

This commit is contained in:
陈浩 Nineteen 2023-02-05 16:06:53 +08:00 committed by GitHub
parent 65da789215
commit 8c90f892b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,9 +21,11 @@ import com.alibaba.nacos.api.naming.remote.NamingRemoteConstants;
import com.alibaba.nacos.api.naming.remote.request.BatchInstanceRequest; import com.alibaba.nacos.api.naming.remote.request.BatchInstanceRequest;
import com.alibaba.nacos.api.naming.remote.response.BatchInstanceResponse; import com.alibaba.nacos.api.naming.remote.response.BatchInstanceResponse;
import com.alibaba.nacos.api.remote.request.RequestMeta; import com.alibaba.nacos.api.remote.request.RequestMeta;
import com.alibaba.nacos.auth.annotation.Secured;
import com.alibaba.nacos.core.remote.RequestHandler; import com.alibaba.nacos.core.remote.RequestHandler;
import com.alibaba.nacos.naming.core.v2.pojo.Service; import com.alibaba.nacos.naming.core.v2.pojo.Service;
import com.alibaba.nacos.naming.core.v2.service.impl.EphemeralClientOperationServiceImpl; import com.alibaba.nacos.naming.core.v2.service.impl.EphemeralClientOperationServiceImpl;
import com.alibaba.nacos.plugin.auth.constant.ActionTypes;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
@ -41,6 +43,7 @@ public class BatchInstanceRequestHandler extends RequestHandler<BatchInstanceReq
} }
@Override @Override
@Secured(action = ActionTypes.WRITE)
public BatchInstanceResponse handle(BatchInstanceRequest request, RequestMeta meta) throws NacosException { public BatchInstanceResponse handle(BatchInstanceRequest request, RequestMeta meta) throws NacosException {
Service service = Service.newService(request.getNamespace(), request.getGroupName(), request.getServiceName(), Service service = Service.newService(request.getNamespace(), request.getGroupName(), request.getServiceName(),
true); true);