@ -22,7 +22,7 @@
|
|||||||
| Spring Cloud | Hoxton.SR9 |
|
| Spring Cloud | Hoxton.SR9 |
|
||||||
| Spring Cloud Alibaba | 2.2.3.RELEASE |
|
| Spring Cloud Alibaba | 2.2.3.RELEASE |
|
||||||
| Spring Security OAuth2 | 2.3.6 |
|
| Spring Security OAuth2 | 2.3.6 |
|
||||||
| Mybatis Plus | 3.4.0 |
|
| Mybatis Plus | 3.4.1 |
|
||||||
| hutool | 5.4.7 |
|
| hutool | 5.4.7 |
|
||||||
| Avue | 2.6.16 |
|
| Avue | 2.6.16 |
|
||||||
|
|
||||||
|
@ -17,16 +17,13 @@
|
|||||||
package com.pig4cloud.pig.common.core.config;
|
package com.pig4cloud.pig.common.core.config;
|
||||||
|
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import com.pig4cloud.pig.common.core.mybatis.SqlFilterArgumentResolver;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.format.FormatterRegistry;
|
import org.springframework.format.FormatterRegistry;
|
||||||
import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
|
import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
|
||||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type.SERVLET;
|
import static org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type.SERVLET;
|
||||||
|
|
||||||
@ -40,11 +37,6 @@ import static org.springframework.boot.autoconfigure.condition.ConditionalOnWebA
|
|||||||
@ConditionalOnWebApplication(type = SERVLET)
|
@ConditionalOnWebApplication(type = SERVLET)
|
||||||
public class WebMvcConfiguration implements WebMvcConfigurer {
|
public class WebMvcConfiguration implements WebMvcConfigurer {
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
|
||||||
argumentResolvers.add(new SqlFilterArgumentResolver());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加GET请求参数中时间类型转换 {@link com.pig4cloud.pig.common.core.jackson.PigJavaTimeModule}
|
* 增加GET请求参数中时间类型转换 {@link com.pig4cloud.pig.common.core.jackson.PigJavaTimeModule}
|
||||||
* <ul>
|
* <ul>
|
||||||
|
@ -31,6 +31,12 @@
|
|||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!--hutool-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-core</artifactId>
|
||||||
|
<version>${hutool.version}</version>
|
||||||
|
</dependency>
|
||||||
<!--mybatis-->
|
<!--mybatis-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
@ -42,5 +48,15 @@
|
|||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--server-api-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-webmvc</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -16,9 +16,16 @@
|
|||||||
|
|
||||||
package com.pig4cloud.pig.common.mybatis;
|
package com.pig4cloud.pig.common.mybatis;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
|
import com.pig4cloud.pig.common.mybatis.resolver.SqlFilterArgumentResolver;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lengleng
|
* @author lengleng
|
||||||
@ -27,15 +34,25 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
* mybatis plus 统一配置
|
* mybatis plus 统一配置
|
||||||
*/
|
*/
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
public class MybatisAutoConfiguration {
|
public class MybatisAutoConfiguration implements WebMvcConfigurer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页插件
|
* SQL 过滤器避免SQL 注入
|
||||||
* @return PaginationInterceptor
|
* @param argumentResolvers
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
||||||
|
argumentResolvers.add(new SqlFilterArgumentResolver());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页插件, 对于单一数据库类型来说,都建议配置该值,避免每次分页都去抓取数据库类型
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public PaginationInterceptor paginationInterceptor() {
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||||
return new PaginationInterceptor();
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||||
|
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||||
|
return interceptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.pig4cloud.pig.common.core.mybatis;
|
package com.pig4cloud.pig.common.mybatis.resolver;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
@ -26,11 +26,16 @@
|
|||||||
<name>pig-register</name>
|
<name>pig-register</name>
|
||||||
<description>nacos 注册配置中心</description>
|
<description>nacos 注册配置中心</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<jjwt.version>0.11.2</jjwt.version>
|
||||||
|
<nacos.version>1.4.0</nacos.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud.nacos</groupId>
|
<groupId>com.pig4cloud.nacos</groupId>
|
||||||
<artifactId>nacos-config</artifactId>
|
<artifactId>nacos-config</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>${nacos.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.tomcat.embed</groupId>
|
<groupId>org.apache.tomcat.embed</groupId>
|
||||||
@ -39,13 +44,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud.nacos</groupId>
|
<groupId>com.pig4cloud.nacos</groupId>
|
||||||
<artifactId>nacos-naming</artifactId>
|
<artifactId>nacos-naming</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>${nacos.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pig4cloud.nacos</groupId>
|
<groupId>com.pig4cloud.nacos</groupId>
|
||||||
<artifactId>nacos-istio</artifactId>
|
<artifactId>nacos-istio</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>${nacos.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
@ -54,18 +59,18 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
<artifactId>jjwt-api</artifactId>
|
<artifactId>jjwt-api</artifactId>
|
||||||
<version>0.10.5</version>
|
<version>${jjwt.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
<artifactId>jjwt-impl</artifactId>
|
<artifactId>jjwt-impl</artifactId>
|
||||||
<version>0.10.5</version>
|
<version>${jjwt.version}</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
<artifactId>jjwt-jackson</artifactId>
|
<artifactId>jjwt-jackson</artifactId>
|
||||||
<version>0.10.5</version>
|
<version>${jjwt.version}</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos;
|
package com.alibaba.nacos;
|
||||||
|
|
||||||
import com.alibaba.nacos.config.ConfigConstants;
|
import com.alibaba.nacos.utils.StartUpEnvInitUtil;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
@ -31,8 +31,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|||||||
public class PigNacosApplication {
|
public class PigNacosApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.setProperty(ConfigConstants.STANDALONE_MODE, "true");
|
StartUpEnvInitUtil.init();
|
||||||
System.setProperty(ConfigConstants.AUTH_ENABLED, "false");
|
|
||||||
SpringApplication.run(PigNacosApplication.class, args);
|
SpringApplication.run(PigNacosApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,4 +35,14 @@ public interface ConfigConstants {
|
|||||||
*/
|
*/
|
||||||
String AUTH_ENABLED = "nacos.core.auth.enabled";
|
String AUTH_ENABLED = "nacos.core.auth.enabled";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启 MCP server
|
||||||
|
*/
|
||||||
|
String MCP_SERVER_ENABLED = "nacos.istio.mcp.server.enabled";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nacos tomcat basedir
|
||||||
|
*/
|
||||||
|
String NACOS_TOMCAT_BASEDIR = "server.tomcat.basedir";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
0
pig-register/src/main/java/com/alibaba/nacos/controller/HealthController.java
Normal file → Executable file
4
pig-register/src/main/java/com/alibaba/nacos/controller/NamespaceController.java
Normal file → Executable file
@ -16,14 +16,14 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos.controller;
|
package com.alibaba.nacos.controller;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.auth.annotation.Secured;
|
||||||
|
import com.alibaba.nacos.auth.common.ActionTypes;
|
||||||
import com.alibaba.nacos.common.model.RestResult;
|
import com.alibaba.nacos.common.model.RestResult;
|
||||||
import com.alibaba.nacos.config.server.model.TenantInfo;
|
import com.alibaba.nacos.config.server.model.TenantInfo;
|
||||||
import com.alibaba.nacos.config.server.service.repository.PersistService;
|
import com.alibaba.nacos.config.server.service.repository.PersistService;
|
||||||
import com.alibaba.nacos.model.Namespace;
|
import com.alibaba.nacos.model.Namespace;
|
||||||
import com.alibaba.nacos.model.NamespaceAllInfo;
|
import com.alibaba.nacos.model.NamespaceAllInfo;
|
||||||
import com.alibaba.nacos.security.nacos.NacosAuthConfig;
|
import com.alibaba.nacos.security.nacos.NacosAuthConfig;
|
||||||
import com.alibaba.nacos.core.auth.ActionTypes;
|
|
||||||
import com.alibaba.nacos.core.auth.Secured;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
11
pig-register/src/main/java/com/alibaba/nacos/controller/PermissionController.java
Normal file → Executable file
@ -16,19 +16,14 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos.controller;
|
package com.alibaba.nacos.controller;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.auth.annotation.Secured;
|
||||||
|
import com.alibaba.nacos.auth.common.ActionTypes;
|
||||||
import com.alibaba.nacos.common.model.RestResult;
|
import com.alibaba.nacos.common.model.RestResult;
|
||||||
import com.alibaba.nacos.security.nacos.NacosAuthConfig;
|
import com.alibaba.nacos.security.nacos.NacosAuthConfig;
|
||||||
import com.alibaba.nacos.security.nacos.roles.NacosRoleServiceImpl;
|
import com.alibaba.nacos.security.nacos.roles.NacosRoleServiceImpl;
|
||||||
import com.alibaba.nacos.core.auth.ActionTypes;
|
|
||||||
import com.alibaba.nacos.core.auth.Secured;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permission operation controller.
|
* Permission operation controller.
|
||||||
|
24
pig-register/src/main/java/com/alibaba/nacos/controller/RoleController.java
Normal file → Executable file
@ -16,19 +16,16 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos.controller;
|
package com.alibaba.nacos.controller;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.auth.annotation.Secured;
|
||||||
|
import com.alibaba.nacos.auth.common.ActionTypes;
|
||||||
import com.alibaba.nacos.common.model.RestResult;
|
import com.alibaba.nacos.common.model.RestResult;
|
||||||
import com.alibaba.nacos.security.nacos.NacosAuthConfig;
|
import com.alibaba.nacos.security.nacos.NacosAuthConfig;
|
||||||
import com.alibaba.nacos.security.nacos.roles.NacosRoleServiceImpl;
|
import com.alibaba.nacos.security.nacos.roles.NacosRoleServiceImpl;
|
||||||
import com.alibaba.nacos.core.auth.ActionTypes;
|
|
||||||
import com.alibaba.nacos.core.auth.Secured;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import java.util.List;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Role operation controller.
|
* Role operation controller.
|
||||||
@ -57,6 +54,17 @@ public class RoleController {
|
|||||||
return roleService.getRolesFromDatabase(username, pageNo, pageSize);
|
return roleService.getRolesFromDatabase(username, pageNo, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fuzzy matching role name .
|
||||||
|
* @param role role id
|
||||||
|
* @return role list
|
||||||
|
*/
|
||||||
|
@GetMapping("/search")
|
||||||
|
@Secured(resource = NacosAuthConfig.CONSOLE_RESOURCE_NAME_PREFIX + "roles", action = ActionTypes.READ)
|
||||||
|
public List<String> searchRoles(@RequestParam String role) {
|
||||||
|
return roleService.findRolesLikeRoleName(role);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a role to a user
|
* Add a role to a user
|
||||||
*
|
*
|
||||||
|
2
pig-register/src/main/java/com/alibaba/nacos/controller/ServerStateController.java
Normal file → Executable file
@ -17,7 +17,7 @@
|
|||||||
package com.alibaba.nacos.controller;
|
package com.alibaba.nacos.controller;
|
||||||
|
|
||||||
import com.alibaba.nacos.common.utils.VersionUtils;
|
import com.alibaba.nacos.common.utils.VersionUtils;
|
||||||
import com.alibaba.nacos.core.utils.ApplicationUtils;
|
import com.alibaba.nacos.sys.utils.ApplicationUtils;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
21
pig-register/src/main/java/com/alibaba/nacos/controller/UserController.java
Normal file → Executable file
@ -17,6 +17,11 @@
|
|||||||
package com.alibaba.nacos.controller;
|
package com.alibaba.nacos.controller;
|
||||||
|
|
||||||
import com.alibaba.nacos.api.common.Constants;
|
import com.alibaba.nacos.api.common.Constants;
|
||||||
|
import com.alibaba.nacos.auth.annotation.Secured;
|
||||||
|
import com.alibaba.nacos.auth.common.ActionTypes;
|
||||||
|
import com.alibaba.nacos.auth.common.AuthConfigs;
|
||||||
|
import com.alibaba.nacos.auth.common.AuthSystemTypes;
|
||||||
|
import com.alibaba.nacos.auth.exception.AccessException;
|
||||||
import com.alibaba.nacos.common.model.RestResult;
|
import com.alibaba.nacos.common.model.RestResult;
|
||||||
import com.alibaba.nacos.common.utils.JacksonUtils;
|
import com.alibaba.nacos.common.utils.JacksonUtils;
|
||||||
import com.alibaba.nacos.config.server.auth.RoleInfo;
|
import com.alibaba.nacos.config.server.auth.RoleInfo;
|
||||||
@ -28,11 +33,6 @@ import com.alibaba.nacos.security.nacos.users.NacosUser;
|
|||||||
import com.alibaba.nacos.security.nacos.users.NacosUserDetailsServiceImpl;
|
import com.alibaba.nacos.security.nacos.users.NacosUserDetailsServiceImpl;
|
||||||
import com.alibaba.nacos.utils.JwtTokenUtils;
|
import com.alibaba.nacos.utils.JwtTokenUtils;
|
||||||
import com.alibaba.nacos.utils.PasswordEncoderUtil;
|
import com.alibaba.nacos.utils.PasswordEncoderUtil;
|
||||||
import com.alibaba.nacos.core.auth.AccessException;
|
|
||||||
import com.alibaba.nacos.core.auth.ActionTypes;
|
|
||||||
import com.alibaba.nacos.core.auth.AuthConfigs;
|
|
||||||
import com.alibaba.nacos.core.auth.AuthSystemTypes;
|
|
||||||
import com.alibaba.nacos.core.auth.Secured;
|
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.authentication.AuthenticationManager;
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
@ -249,4 +249,15 @@ public class UserController {
|
|||||||
return rr;
|
return rr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fuzzy matching username.
|
||||||
|
* @param username username
|
||||||
|
* @return Matched username
|
||||||
|
*/
|
||||||
|
@GetMapping("/search")
|
||||||
|
@Secured(resource = NacosAuthConfig.CONSOLE_RESOURCE_NAME_PREFIX + "users", action = ActionTypes.WRITE)
|
||||||
|
public List<String> searchUsersLikeUsername(@RequestParam String username) {
|
||||||
|
return userDetailsService.findUserLikeUsername(username);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
2
pig-register/src/main/java/com/alibaba/nacos/exception/ConsoleExceptionHandler.java
Normal file → Executable file
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos.exception;
|
package com.alibaba.nacos.exception;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.auth.exception.AccessException;
|
||||||
import com.alibaba.nacos.common.utils.ExceptionUtil;
|
import com.alibaba.nacos.common.utils.ExceptionUtil;
|
||||||
import com.alibaba.nacos.core.auth.AccessException;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
0
pig-register/src/main/java/com/alibaba/nacos/filter/JwtAuthenticationTokenFilter.java
Normal file → Executable file
0
pig-register/src/main/java/com/alibaba/nacos/model/Namespace.java
Normal file → Executable file
0
pig-register/src/main/java/com/alibaba/nacos/model/NamespaceAllInfo.java
Normal file → Executable file
0
pig-register/src/main/java/com/alibaba/nacos/security/nacos/CustomAuthenticationProvider.java
Normal file → Executable file
0
pig-register/src/main/java/com/alibaba/nacos/security/nacos/JwtAuthenticationEntryPoint.java
Normal file → Executable file
12
pig-register/src/main/java/com/alibaba/nacos/security/nacos/JwtTokenManager.java
Normal file → Executable file
@ -16,10 +16,11 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos.security.nacos;
|
package com.alibaba.nacos.security.nacos;
|
||||||
|
|
||||||
import com.alibaba.nacos.core.auth.AuthConfigs;
|
import com.alibaba.nacos.auth.common.AuthConfigs;
|
||||||
import io.jsonwebtoken.Claims;
|
import io.jsonwebtoken.Claims;
|
||||||
import io.jsonwebtoken.Jwts;
|
import io.jsonwebtoken.Jwts;
|
||||||
import io.jsonwebtoken.SignatureAlgorithm;
|
import io.jsonwebtoken.SignatureAlgorithm;
|
||||||
|
import io.jsonwebtoken.security.Keys;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
@ -67,9 +68,8 @@ public class JwtTokenManager {
|
|||||||
validity = new Date(now + authConfigs.getTokenValidityInSeconds() * 1000L);
|
validity = new Date(now + authConfigs.getTokenValidityInSeconds() * 1000L);
|
||||||
|
|
||||||
Claims claims = Jwts.claims().setSubject(userName);
|
Claims claims = Jwts.claims().setSubject(userName);
|
||||||
|
|
||||||
return Jwts.builder().setClaims(claims).setExpiration(validity)
|
return Jwts.builder().setClaims(claims).setExpiration(validity)
|
||||||
.signWith(SignatureAlgorithm.HS256, authConfigs.getSecretKey()).compact();
|
.signWith(Keys.hmacShaKeyFor(authConfigs.getSecretKeyBytes()), SignatureAlgorithm.HS256).compact();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,8 +78,8 @@ public class JwtTokenManager {
|
|||||||
* @return auth info
|
* @return auth info
|
||||||
*/
|
*/
|
||||||
public Authentication getAuthentication(String token) {
|
public Authentication getAuthentication(String token) {
|
||||||
|
Claims claims = Jwts.parserBuilder().setSigningKey(authConfigs.getSecretKeyBytes()).build()
|
||||||
Claims claims = Jwts.parser().setSigningKey(authConfigs.getSecretKey()).parseClaimsJws(token).getBody();
|
.parseClaimsJws(token).getBody();
|
||||||
|
|
||||||
List<GrantedAuthority> authorities = AuthorityUtils
|
List<GrantedAuthority> authorities = AuthorityUtils
|
||||||
.commaSeparatedStringToAuthorityList((String) claims.get(AUTHORITIES_KEY));
|
.commaSeparatedStringToAuthorityList((String) claims.get(AUTHORITIES_KEY));
|
||||||
@ -93,7 +93,7 @@ public class JwtTokenManager {
|
|||||||
* @param token token
|
* @param token token
|
||||||
*/
|
*/
|
||||||
public void validateToken(String token) {
|
public void validateToken(String token) {
|
||||||
Jwts.parser().setSigningKey(authConfigs.getSecretKey()).parseClaimsJws(token);
|
Jwts.parserBuilder().setSigningKey(authConfigs.getSecretKeyBytes()).build().parseClaimsJws(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
4
pig-register/src/main/java/com/alibaba/nacos/security/nacos/NacosAuthConfig.java
Normal file → Executable file
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos.security.nacos;
|
package com.alibaba.nacos.security.nacos;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.auth.common.AuthConfigs;
|
||||||
|
import com.alibaba.nacos.auth.common.AuthSystemTypes;
|
||||||
import com.alibaba.nacos.filter.JwtAuthenticationTokenFilter;
|
import com.alibaba.nacos.filter.JwtAuthenticationTokenFilter;
|
||||||
import com.alibaba.nacos.security.nacos.users.NacosUserDetailsServiceImpl;
|
import com.alibaba.nacos.security.nacos.users.NacosUserDetailsServiceImpl;
|
||||||
import com.alibaba.nacos.core.auth.AuthConfigs;
|
|
||||||
import com.alibaba.nacos.core.auth.AuthSystemTypes;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
11
pig-register/src/main/java/com/alibaba/nacos/security/nacos/NacosAuthManager.java
Normal file → Executable file
@ -17,13 +17,14 @@
|
|||||||
package com.alibaba.nacos.security.nacos;
|
package com.alibaba.nacos.security.nacos;
|
||||||
|
|
||||||
import com.alibaba.nacos.api.common.Constants;
|
import com.alibaba.nacos.api.common.Constants;
|
||||||
|
import com.alibaba.nacos.auth.AuthManager;
|
||||||
|
import com.alibaba.nacos.auth.exception.AccessException;
|
||||||
|
import com.alibaba.nacos.auth.model.Permission;
|
||||||
|
import com.alibaba.nacos.auth.model.User;
|
||||||
import com.alibaba.nacos.config.server.auth.RoleInfo;
|
import com.alibaba.nacos.config.server.auth.RoleInfo;
|
||||||
|
import com.alibaba.nacos.config.server.utils.RequestUtil;
|
||||||
import com.alibaba.nacos.security.nacos.roles.NacosRoleServiceImpl;
|
import com.alibaba.nacos.security.nacos.roles.NacosRoleServiceImpl;
|
||||||
import com.alibaba.nacos.security.nacos.users.NacosUser;
|
import com.alibaba.nacos.security.nacos.users.NacosUser;
|
||||||
import com.alibaba.nacos.core.auth.AccessException;
|
|
||||||
import com.alibaba.nacos.core.auth.AuthManager;
|
|
||||||
import com.alibaba.nacos.core.auth.Permission;
|
|
||||||
import com.alibaba.nacos.core.auth.User;
|
|
||||||
import com.alibaba.nacos.core.utils.Loggers;
|
import com.alibaba.nacos.core.utils.Loggers;
|
||||||
import io.jsonwebtoken.ExpiredJwtException;
|
import io.jsonwebtoken.ExpiredJwtException;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -92,7 +93,7 @@ public class NacosAuthManager implements AuthManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
req.setAttribute(RequestUtil.NACOS_USER_KEY, user);
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
pig-register/src/main/java/com/alibaba/nacos/security/nacos/roles/NacosRoleServiceImpl.java
Normal file → Executable file
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos.security.nacos.roles;
|
package com.alibaba.nacos.security.nacos.roles;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.auth.common.AuthConfigs;
|
||||||
|
import com.alibaba.nacos.auth.model.Permission;
|
||||||
import com.alibaba.nacos.config.server.auth.PermissionInfo;
|
import com.alibaba.nacos.config.server.auth.PermissionInfo;
|
||||||
import com.alibaba.nacos.config.server.auth.PermissionPersistService;
|
import com.alibaba.nacos.config.server.auth.PermissionPersistService;
|
||||||
import com.alibaba.nacos.config.server.auth.RoleInfo;
|
import com.alibaba.nacos.config.server.auth.RoleInfo;
|
||||||
@ -23,8 +25,6 @@ import com.alibaba.nacos.config.server.auth.RolePersistService;
|
|||||||
import com.alibaba.nacos.config.server.model.Page;
|
import com.alibaba.nacos.config.server.model.Page;
|
||||||
import com.alibaba.nacos.security.nacos.NacosAuthConfig;
|
import com.alibaba.nacos.security.nacos.NacosAuthConfig;
|
||||||
import com.alibaba.nacos.security.nacos.users.NacosUserDetailsServiceImpl;
|
import com.alibaba.nacos.security.nacos.users.NacosUserDetailsServiceImpl;
|
||||||
import com.alibaba.nacos.core.auth.AuthConfigs;
|
|
||||||
import com.alibaba.nacos.core.auth.Permission;
|
|
||||||
import com.alibaba.nacos.core.utils.Loggers;
|
import com.alibaba.nacos.core.utils.Loggers;
|
||||||
import io.jsonwebtoken.lang.Collections;
|
import io.jsonwebtoken.lang.Collections;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -235,4 +235,8 @@ public class NacosRoleServiceImpl {
|
|||||||
permissionPersistService.deletePermission(role, resource, action);
|
permissionPersistService.deletePermission(role, resource, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> findRolesLikeRoleName(String role) {
|
||||||
|
return rolePersistService.findRolesLikeRoleName(role);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
2
pig-register/src/main/java/com/alibaba/nacos/security/nacos/users/NacosUser.java
Normal file → Executable file
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos.security.nacos.users;
|
package com.alibaba.nacos.security.nacos.users;
|
||||||
|
|
||||||
import com.alibaba.nacos.core.auth.User;
|
import com.alibaba.nacos.auth.model.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nacos User.
|
* Nacos User.
|
||||||
|
0
pig-register/src/main/java/com/alibaba/nacos/security/nacos/users/NacosUserDetails.java
Normal file → Executable file
7
pig-register/src/main/java/com/alibaba/nacos/security/nacos/users/NacosUserDetailsServiceImpl.java
Normal file → Executable file
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos.security.nacos.users;
|
package com.alibaba.nacos.security.nacos.users;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.auth.common.AuthConfigs;
|
||||||
import com.alibaba.nacos.config.server.auth.UserPersistService;
|
import com.alibaba.nacos.config.server.auth.UserPersistService;
|
||||||
import com.alibaba.nacos.config.server.model.Page;
|
import com.alibaba.nacos.config.server.model.Page;
|
||||||
import com.alibaba.nacos.config.server.model.User;
|
import com.alibaba.nacos.config.server.model.User;
|
||||||
import com.alibaba.nacos.core.auth.AuthConfigs;
|
|
||||||
import com.alibaba.nacos.core.utils.Loggers;
|
import com.alibaba.nacos.core.utils.Loggers;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
@ -28,6 +28,7 @@ import org.springframework.security.core.userdetails.UserDetailsService;
|
|||||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@ -101,6 +102,10 @@ public class NacosUserDetailsServiceImpl implements UserDetailsService {
|
|||||||
return userPersistService.findUserByUsername(username);
|
return userPersistService.findUserByUsername(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> findUserLikeUsername(String username) {
|
||||||
|
return userPersistService.findUserLikeUsername(username);
|
||||||
|
}
|
||||||
|
|
||||||
public void createUser(String username, String password) {
|
public void createUser(String username, String password) {
|
||||||
userPersistService.createUser(username, password);
|
userPersistService.createUser(username, password);
|
||||||
}
|
}
|
||||||
|
10
pig-register/src/main/java/com/alibaba/nacos/utils/JwtTokenUtils.java
Normal file → Executable file
@ -21,9 +21,9 @@ import io.jsonwebtoken.ExpiredJwtException;
|
|||||||
import io.jsonwebtoken.Jwts;
|
import io.jsonwebtoken.Jwts;
|
||||||
import io.jsonwebtoken.MalformedJwtException;
|
import io.jsonwebtoken.MalformedJwtException;
|
||||||
import io.jsonwebtoken.SignatureAlgorithm;
|
import io.jsonwebtoken.SignatureAlgorithm;
|
||||||
import io.jsonwebtoken.SignatureException;
|
|
||||||
import io.jsonwebtoken.UnsupportedJwtException;
|
import io.jsonwebtoken.UnsupportedJwtException;
|
||||||
import io.jsonwebtoken.security.Keys;
|
import io.jsonwebtoken.security.Keys;
|
||||||
|
import io.jsonwebtoken.security.SecurityException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@ -126,9 +126,7 @@ public class JwtTokenUtils {
|
|||||||
* @return auth info
|
* @return auth info
|
||||||
*/
|
*/
|
||||||
public Authentication getAuthentication(String token) {
|
public Authentication getAuthentication(String token) {
|
||||||
|
Claims claims = Jwts.parserBuilder().setSigningKey(secretKey).build().parseClaimsJws(token).getBody();
|
||||||
Claims claims = Jwts.parser().setSigningKey(secretKey).parseClaimsJws(token).getBody();
|
|
||||||
|
|
||||||
List<GrantedAuthority> authorities = AuthorityUtils
|
List<GrantedAuthority> authorities = AuthorityUtils
|
||||||
.commaSeparatedStringToAuthorityList((String) claims.get(AUTHORITIES_KEY));
|
.commaSeparatedStringToAuthorityList((String) claims.get(AUTHORITIES_KEY));
|
||||||
|
|
||||||
@ -143,10 +141,10 @@ public class JwtTokenUtils {
|
|||||||
*/
|
*/
|
||||||
public boolean validateToken(String token) {
|
public boolean validateToken(String token) {
|
||||||
try {
|
try {
|
||||||
Jwts.parser().setSigningKey(secretKey).parseClaimsJws(token);
|
Jwts.parserBuilder().setSigningKey(secretKey).build().parseClaimsJws(token);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SignatureException e) {
|
catch (SecurityException e) {
|
||||||
log.info("Invalid JWT signature.");
|
log.info("Invalid JWT signature.");
|
||||||
log.trace("Invalid JWT signature trace: {}", e);
|
log.trace("Invalid JWT signature trace: {}", e);
|
||||||
}
|
}
|
||||||
|
0
pig-register/src/main/java/com/alibaba/nacos/utils/PasswordEncoderUtil.java
Normal file → Executable file
@ -0,0 +1,33 @@
|
|||||||
|
package com.alibaba.nacos.utils;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.config.ConfigConstants;
|
||||||
|
import com.alibaba.nacos.sys.utils.ApplicationUtils;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lengleng
|
||||||
|
* @date 2020/11/7
|
||||||
|
* <p>
|
||||||
|
* 初始化启动配置
|
||||||
|
*/
|
||||||
|
@UtilityClass
|
||||||
|
public class StartUpEnvInitUtil {
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public void init() {
|
||||||
|
// 启动时候, 创建对应目录. 避免 1.4.0 启动失败
|
||||||
|
String confFilePath = ApplicationUtils.getConfFilePath();
|
||||||
|
FileUtils.forceMkdir(new File(confFilePath));
|
||||||
|
|
||||||
|
// 设置环境变量,Nacos 读取这部分配置
|
||||||
|
System.setProperty(ConfigConstants.NACOS_TOMCAT_BASEDIR, ApplicationUtils.getNacosTmpDir());
|
||||||
|
System.setProperty(ConfigConstants.STANDALONE_MODE, Boolean.TRUE.toString());
|
||||||
|
System.setProperty(ConfigConstants.AUTH_ENABLED, Boolean.FALSE.toString());
|
||||||
|
System.setProperty(ConfigConstants.MCP_SERVER_ENABLED, Boolean.FALSE.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,7 +1,5 @@
|
|||||||
server:
|
server:
|
||||||
port: 8848
|
port: 8848
|
||||||
tomcat:
|
|
||||||
basedir: logs
|
|
||||||
|
|
||||||
db:
|
db:
|
||||||
num: 1
|
num: 1
|
||||||
@ -21,17 +19,33 @@ nacos:
|
|||||||
urls: /,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
|
urls: /,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
|
application:
|
||||||
|
name: @artifactId@
|
||||||
datasource:
|
datasource:
|
||||||
platform: mysql
|
platform: mysql
|
||||||
security:
|
security:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
boot: # 接入 spring boot admin
|
||||||
|
admin:
|
||||||
|
client:
|
||||||
|
url: http://pig-monitor:5001
|
||||||
|
username: pig
|
||||||
|
password: pig
|
||||||
|
|
||||||
useAddressServer: true
|
useAddressServer: true
|
||||||
|
|
||||||
|
# 关闭监控埋点采集
|
||||||
management:
|
management:
|
||||||
|
endpoints:
|
||||||
|
web:
|
||||||
|
exposure:
|
||||||
|
include: '*'
|
||||||
|
endpoint:
|
||||||
|
health:
|
||||||
|
show-details: always
|
||||||
metrics:
|
metrics:
|
||||||
export:
|
export:
|
||||||
influx:
|
|
||||||
enabled: false
|
|
||||||
elastic:
|
elastic:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
influx:
|
||||||
|
enabled: false
|
@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
"presets": [
|
|
||||||
[
|
|
||||||
"@babel/preset-env",
|
|
||||||
{
|
|
||||||
"useBuiltIns": "entry"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"react-app"
|
|
||||||
],
|
|
||||||
"plugins": [
|
|
||||||
[
|
|
||||||
"@babel/plugin-proposal-decorators",
|
|
||||||
{
|
|
||||||
"legacy": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"babel-plugin-import",
|
|
||||||
{
|
|
||||||
"libraryName": "@alifd/next",
|
|
||||||
"style": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
# http://editorconfig.org
|
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
end_of_line = lf
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
||||||
|
|
||||||
[*.md]
|
|
||||||
trim_trailing_whitespace = false
|
|
||||||
|
|
||||||
[Makefile]
|
|
||||||
indent_style = tab
|
|
@ -1,6 +0,0 @@
|
|||||||
*.svg
|
|
||||||
*.ejs
|
|
||||||
.DS_Store
|
|
||||||
build
|
|
||||||
node_modules
|
|
||||||
public
|
|
@ -1,36 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "eslint-config-ali/react",
|
|
||||||
"parser": "babel-eslint",
|
|
||||||
"env": {},
|
|
||||||
"globals": {
|
|
||||||
"window": true
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"no-shadow": "off",
|
|
||||||
"no-empty": "off",
|
|
||||||
"no-useless-escape": "off",
|
|
||||||
"no-template-curly-in-string": "off",
|
|
||||||
"no-unused-vars": "off",
|
|
||||||
"no-tabs": "off",
|
|
||||||
"no-param-reassign": "off",
|
|
||||||
"react/no-string-refs": "off",
|
|
||||||
"react/no-unused-state": "off",
|
|
||||||
"no-return-assign": "off",
|
|
||||||
"no-plusplus": "off",
|
|
||||||
"no-script-url": "off",
|
|
||||||
"no-mixed-operators": "off",
|
|
||||||
"react/jsx-indent": "off",
|
|
||||||
"react/jsx-no-bind": "off",
|
|
||||||
"react/forbid-prop-types": "off",
|
|
||||||
"react/no-array-index-key": "off",
|
|
||||||
"react/sort-comp": "off",
|
|
||||||
"implicit-arrow-linebreak": "off",
|
|
||||||
"prefer-const": "off",
|
|
||||||
"space-before-function-paren": "off",
|
|
||||||
"generator-star-spacing": "off",
|
|
||||||
"wrap-iife": "off",
|
|
||||||
"arrow-parens": "off",
|
|
||||||
"indent": "off",
|
|
||||||
"comma-dangle": "off"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
/node_modules
|
|
||||||
|
|
||||||
# production
|
|
||||||
/dist
|
|
||||||
|
|
||||||
# log
|
|
||||||
yarn-error.log
|
|
||||||
|
|
||||||
# misc
|
|
||||||
.DS_Store
|
|
||||||
npm-debug.log*
|
|
||||||
|
|
||||||
# test
|
|
||||||
test/uirecorder.log
|
|
||||||
test/reports
|
|
||||||
test/screenshots/*
|
|
@ -1,6 +0,0 @@
|
|||||||
*.svg
|
|
||||||
*.ejs
|
|
||||||
.DS_Store
|
|
||||||
build
|
|
||||||
node_modules
|
|
||||||
public
|
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"tabWidth": 2,
|
|
||||||
"printWidth": 100,
|
|
||||||
"semi": true,
|
|
||||||
"useTabs": false,
|
|
||||||
"bracketSpacing": true,
|
|
||||||
"singleQuote": true,
|
|
||||||
"trailingComma": "es5"
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
# 开始项目
|
|
||||||
## cnpm 安装(可忽略)
|
|
||||||
```sh
|
|
||||||
npm install -g cnpm --registry=https://registry.npm.taobao.org
|
|
||||||
|
|
||||||
# 设置匿名
|
|
||||||
alias cnpm="npm --registry=https://registry.npm.taobao.org \
|
|
||||||
--cache=$HOME/.npm/.cache/cnpm \
|
|
||||||
--disturl=https://npm.taobao.org/dist \
|
|
||||||
--userconfig=$HOME/.cnpmrc"
|
|
||||||
|
|
||||||
# Or alias it in .bashrc or .zshrc
|
|
||||||
$ echo '\n#alias for cnpm\nalias cnpm="npm --registry=https://registry.npm.taobao.org \
|
|
||||||
--cache=$HOME/.npm/.cache/cnpm \
|
|
||||||
--disturl=https://npm.taobao.org/dist \
|
|
||||||
--userconfig=$HOME/.cnpmrc"' >> ~/.zshrc && source ~/.zshrc
|
|
||||||
|
|
||||||
```
|
|
||||||
[详情地址: http://npm.taobao.org/](http://npm.taobao.org/)
|
|
||||||
|
|
||||||
## 安装依赖
|
|
||||||
```sh
|
|
||||||
yarn
|
|
||||||
```
|
|
||||||
或
|
|
||||||
```
|
|
||||||
cnpm install
|
|
||||||
```
|
|
||||||
|
|
||||||
## 启动
|
|
||||||
```sh
|
|
||||||
yarn start
|
|
||||||
```
|
|
||||||
或
|
|
||||||
```
|
|
||||||
npm start
|
|
||||||
```
|
|
||||||
|
|
||||||
## 构建打包
|
|
||||||
```sh
|
|
||||||
yarn build
|
|
||||||
```
|
|
||||||
或
|
|
||||||
```
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
##
|
|
||||||
|
|
||||||
# 代理配置
|
|
||||||
`build/webpack.dev.conf.js`
|
|
||||||
修改proxy属性
|
|
||||||
|
|
||||||
```
|
|
||||||
proxy: [{
|
|
||||||
context: ['/'],
|
|
||||||
changeOrigin: true,
|
|
||||||
secure: false,
|
|
||||||
target: 'http://ip:port',
|
|
||||||
}],
|
|
||||||
```
|
|
@ -1,83 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "console-fe",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "console fe",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"start": "cross-env NODE_ENV=development webpack-dev-server --config build/webpack.dev.conf.js",
|
|
||||||
"build": "cross-env NODE_ENV=production webpack --config build/webpack.prod.conf.js && node build/copyFile.js",
|
|
||||||
"eslint": "eslint --ext .js src/",
|
|
||||||
"eslint-fix": "eslint --ext .js --fix src/"
|
|
||||||
},
|
|
||||||
"husky": {
|
|
||||||
"hooks": {
|
|
||||||
"pre-commit": "lint-staged"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lint-staged": {
|
|
||||||
"*.{js,css,less}": [
|
|
||||||
"prettier --write",
|
|
||||||
"git add"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/alibaba/nacos.git"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@alifd/next-theme-loader": "^1.3.1",
|
|
||||||
"@babel/cli": "^7.7.7",
|
|
||||||
"@babel/core": "^7.7.7",
|
|
||||||
"@babel/plugin-proposal-decorators": "^7.7.4",
|
|
||||||
"@babel/preset-env": "^7.7.7",
|
|
||||||
"@babel/runtime": "^7.7.7",
|
|
||||||
"babel-eslint": "^10.0.1",
|
|
||||||
"babel-loader": "^8.0.4",
|
|
||||||
"babel-plugin-import": "^1.13.0",
|
|
||||||
"babel-preset-react-app": "^9.1.0",
|
|
||||||
"clean-webpack-plugin": "^3.0.0",
|
|
||||||
"copy-webpack-plugin": "^5.1.1 ",
|
|
||||||
"cross-env": "^6.0.3",
|
|
||||||
"css-loader": "^3.4.0",
|
|
||||||
"eslint": "^6.8.0",
|
|
||||||
"eslint-config-ali": "^9.0.2",
|
|
||||||
"eslint-config-prettier": "^6.8.0",
|
|
||||||
"eslint-loader": "^3.0.3",
|
|
||||||
"eslint-plugin-import": "^2.14.0",
|
|
||||||
"eslint-plugin-prettier": "^3.0.0",
|
|
||||||
"eslint-plugin-react": "^7.17.0",
|
|
||||||
"eslint-plugin-react-hooks": "^2.3.0",
|
|
||||||
"file-loader": "^5.0.2",
|
|
||||||
"html-webpack-plugin": "^3.2.0",
|
|
||||||
"husky": "^3.1.0",
|
|
||||||
"lint-staged": "^9.5.0",
|
|
||||||
"mini-css-extract-plugin": "^0.9.0",
|
|
||||||
"node-sass": "^4.13.0",
|
|
||||||
"optimize-css-assets-webpack-plugin": "^5.0.3",
|
|
||||||
"prettier": "1.19.1",
|
|
||||||
"sass-loader": "^8.0.0",
|
|
||||||
"style-loader": "^1.1.2",
|
|
||||||
"uglifyjs-webpack-plugin": "^2.2.0",
|
|
||||||
"url-loader": "^3.0.0",
|
|
||||||
"webpack": "^4.43.0",
|
|
||||||
"webpack-cli": "^3.3.12",
|
|
||||||
"webpack-dev-server": "^3.11.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@alifd/next": "^1.17.4",
|
|
||||||
"axios": "^0.18.0",
|
|
||||||
"moment": "^2.23.0",
|
|
||||||
"qs": "^6.8.2",
|
|
||||||
"prop-types": "^15.6.2",
|
|
||||||
"react": "^16.12.0",
|
|
||||||
"react-dom": "^16.12.0",
|
|
||||||
"react-redux": "^7.1.3",
|
|
||||||
"react-router": "^5.1.2",
|
|
||||||
"react-router-dom": "^5.1.2",
|
|
||||||
"react-router-redux": "^4.0.8",
|
|
||||||
"redux": "^4.0.5",
|
|
||||||
"redux-thunk": "^2.3.0",
|
|
||||||
"yamljs": "^0.3.0"
|
|
||||||
}
|
|
||||||
}
|
|
0
pig-register/src/main/resources/static/console-fe/public/css/bootstrap.css
vendored
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/codemirror.css
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/console1412.css
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/font-awesome.css
vendored
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/fonts/aliyun-console-font.eot
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/fonts/aliyun-console-font.ttf
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/fonts/aliyun-console-font.woff
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/fonts/font_515771_emcns5054x3whfr.ttf
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/fonts/font_515771_emcns5054x3whfr.woff
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/fonts/roboto-bold.ttf
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/fonts/roboto-bold.woff
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/fonts/roboto-bold.woff2
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/fonts/roboto-regular.ttf
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/fonts/roboto-regular.woff
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/fonts/roboto-regular.woff2
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/icon.css
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/css/merge.css
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-bold.eot
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-bold.ttf
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-bold.woff
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-bold.woff2
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-light.eot
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-light.ttf
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-light.woff
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-light.woff2
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-medium.eot
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-medium.ttf
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-medium.woff
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-medium.woff2
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-regular.eot
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-regular.ttf
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-regular.woff
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-regular.woff2
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-thin.eot
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-thin.ttf
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-thin.woff
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/fonts/roboto-thin.woff2
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/icons/icon-font.eot
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/icons/icon-font.svg
Normal file → Executable file
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
0
pig-register/src/main/resources/static/console-fe/public/icons/icon-font.ttf
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/icons/icon-font.woff
Normal file → Executable file
0
pig-register/src/main/resources/static/console-fe/public/img/black_dot.png
Normal file → Executable file
Before Width: | Height: | Size: 114 B After Width: | Height: | Size: 114 B |
0
pig-register/src/main/resources/static/console-fe/public/img/favicon.ico
Normal file → Executable file
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
0
pig-register/src/main/resources/static/console-fe/public/img/logo-2000-390.svg
Normal file → Executable file
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
0
pig-register/src/main/resources/static/console-fe/public/img/nacos.png
Normal file → Executable file
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
2
pig-register/src/main/resources/static/console-fe/public/index.html
Normal file → Executable file
@ -23,7 +23,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
<title>Nacos</title>
|
<title>Nacos</title>
|
||||||
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
|
<link rel="shortcut icon" href="img/nacos-logo.png" type="image/x-icon" />
|
||||||
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
|
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
|
||||||
<link rel="stylesheet" type="text/css" href="css/console1412.css">
|
<link rel="stylesheet" type="text/css" href="css/console1412.css">
|
||||||
<!-- 第三方css开始 -->
|
<!-- 第三方css开始 -->
|
||||||
|