mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-15 06:29:01 +08:00
✨ pigx-register支持开启认证模式
This commit is contained in:
1 parent
701a97184d
commit
39a7a4ebf8
21 files changed
+60
-26
No files matched your search
@@ -43,7 +43,7 @@ public class PigxNacosApplication {
|
||||
*/
|
||||
private static boolean initEnv() {
|
||||
System.setProperty(ConfigConstants.STANDALONE_MODE, "true");
|
||||
System.setProperty(ConfigConstants.AUTH_ENABLED, "false");
|
||||
System.setProperty(ConfigConstants.AUTH_ENABLED, "true");
|
||||
System.setProperty(ConfigConstants.LOG_BASEDIR, "logs");
|
||||
System.setProperty(ConfigConstants.LOG_ENABLED, "true");
|
||||
return true;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.alibaba.nacos.config;
|
||||
|
||||
import com.alibaba.nacos.console.filter.XssFilter;
|
||||
import com.alibaba.nacos.core.code.ControllerMethodsCache;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
@@ -39,7 +40,7 @@ import java.time.ZoneId;
|
||||
*/
|
||||
@Component
|
||||
@EnableScheduling
|
||||
@PropertySource("/application.properties")
|
||||
@PropertySource("/application.yml")
|
||||
public class ConsoleConfig {
|
||||
|
||||
@Autowired
|
||||
@@ -64,11 +65,17 @@ public class ConsoleConfig {
|
||||
config.addAllowedHeader("*");
|
||||
config.setMaxAge(18000L);
|
||||
config.addAllowedMethod("*");
|
||||
config.addAllowedOriginPattern("*");
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
source.registerCorsConfiguration("/**", config);
|
||||
return new CorsFilter(source);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public XssFilter xssFilter() {
|
||||
return new XssFilter();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() {
|
||||
return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(ZoneId.systemDefault().toString());
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
server:
|
||||
port: 8848
|
||||
port: 18848
|
||||
tomcat:
|
||||
basedir: logs
|
||||
|
||||
error:
|
||||
include-message: always
|
||||
db:
|
||||
num: 1
|
||||
user: ${MYSQL_USER:root}
|
||||
@@ -13,25 +14,29 @@ db:
|
||||
nacos:
|
||||
core:
|
||||
auth:
|
||||
server:
|
||||
identity:
|
||||
key: serverIdentity
|
||||
value: security
|
||||
system.type: nacos
|
||||
plugin.nacos.token.secret.key: SecretKey012345678901234567890123456789012345678901234567890123456789
|
||||
security:
|
||||
ignore:
|
||||
urls: /,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
|
||||
urls: /actuator/**,/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
platform: mysql #这个过期属性不能修改,nacos 代码对此有硬编码
|
||||
security:
|
||||
enabled: true
|
||||
boot: # 接入 spring boot admin
|
||||
boot: # 接入 spring boot admin
|
||||
admin:
|
||||
client:
|
||||
url: http://pigx-monitor:5001
|
||||
username: pig
|
||||
password: pig
|
||||
instance:
|
||||
prefer-ip: true
|
||||
service-host-type: ip
|
||||
application:
|
||||
name: @project.artifactId@
|
||||
|
||||
|
||||
Reference in new issue
Block a user