mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-09 04:49:02 +08:00
Merge branch 'leng_dev' into lei_dev
This commit is contained in:
commit
cf3f907c5b
24 files changed
+67
-30
No files matched your search
@@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
||||
+6
-1
@@ -6,6 +6,7 @@ import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.security.service.PigRedisOAuth2AuthorizationService;
|
||||
import com.pig4cloud.pigx.common.security.util.OAuth2ErrorCodesExpand;
|
||||
import com.pig4cloud.pigx.common.security.util.ScopeException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -39,6 +40,7 @@ import java.util.function.Supplier;
|
||||
*
|
||||
* 处理自定义授权
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class OAuth2ResourceOwnerBaseAuthenticationProvider<T extends OAuth2ResourceOwnerBaseAuthenticationToken>
|
||||
implements AuthenticationProvider {
|
||||
|
||||
@@ -296,7 +298,10 @@ public abstract class OAuth2ResourceOwnerBaseAuthenticationProvider<T extends OA
|
||||
return new OAuth2AuthenticationException(new OAuth2Error(OAuth2ErrorCodes.INVALID_SCOPE,
|
||||
this.messages.getMessage("AbstractAccessDecisionManager.accessDenied", "invalid_scope"), ""));
|
||||
}
|
||||
return new OAuth2AuthenticationException(OAuth2ErrorCodesExpand.UN_KNOW_LOGIN_ERROR);
|
||||
|
||||
log.error(authenticationException.getLocalizedMessage());
|
||||
return new OAuth2AuthenticationException(new OAuth2Error(OAuth2ErrorCodes.SERVER_ERROR),
|
||||
authenticationException.getLocalizedMessage(), authenticationException);
|
||||
}
|
||||
|
||||
private OAuth2ClientAuthenticationToken getAuthenticatedClientElseThrowInvalidClient(
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
server:
|
||||
port: 3000
|
||||
|
||||
|
||||
security:
|
||||
api:
|
||||
encrypt:
|
||||
aesKey: 'pigxpigxpigxpigx'
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
||||
@@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
||||
@@ -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@
|
||||
|
||||
|
||||
+2
@@ -77,6 +77,7 @@ public class SysOauthClientDetailsServiceImpl extends ServiceImpl<SysOauthClient
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@CacheEvict(value = CacheConstants.CLIENT_DETAILS_KEY, key = "#clientDetailsDTO.clientId")
|
||||
public Boolean updateClientById(SysOauthClientDetailsDTO clientDetailsDTO) {
|
||||
this.insertOrUpdate(clientDetailsDTO);
|
||||
@@ -151,6 +152,7 @@ public class SysOauthClientDetailsServiceImpl extends ServiceImpl<SysOauthClient
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@CacheEvict(value = CacheConstants.CLIENT_DETAILS_KEY, allEntries = true)
|
||||
public R syncClientCache() {
|
||||
// 更新Redis
|
||||
|
||||
+1
-1
@@ -189,7 +189,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||
roleMenu.setMenuId(menu.getMenuId());
|
||||
return roleMenu;
|
||||
}).collect(Collectors.toList());
|
||||
roleMenuList.forEach(ele -> roleMenuMapper.insert(ele));
|
||||
roleMenuList.forEach(roleMenuMapper::insert);
|
||||
// 插入系统字典
|
||||
dictService.saveBatch(dictList.stream().peek(d -> d.setId(null)).collect(Collectors.toList()));
|
||||
// 处理字典项最新关联的字典ID
|
||||
|
||||
@@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
||||
@@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
||||
@@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
@@ -13,4 +15,4 @@ spring:
|
||||
config:
|
||||
import:
|
||||
- optional:nacos:application-@profiles.active@.yml
|
||||
- optional:nacos:${spring.application.name}-@profiles.active@.yml
|
||||
- optional:nacos:${spring.application.name}-@profiles.active@.yml
|
||||
@@ -9,6 +9,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
||||
@@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
service: @artifactId@
|
||||
|
||||
+3
-11
@@ -71,12 +71,8 @@ public class MonitorStatService implements DruidStatServiceMBean {
|
||||
List<ServiceInstance> instances = discoveryClient.getInstances(service);
|
||||
for (ServiceInstance instance : instances) {
|
||||
String host = instance.getHost();
|
||||
String instanceId = instance.getInstanceId();
|
||||
if (instanceId == null) {
|
||||
instanceId = instance.getMetadata().get("nacos.instanceId").replaceAll("#", "-").replaceAll("@@",
|
||||
"-");
|
||||
}
|
||||
int port = instance.getPort();
|
||||
String instanceId = String.format("%s_%s", host, port);
|
||||
String serviceId = instance.getServiceId();
|
||||
// 根据前端参数采集指定的服务
|
||||
if (monitorProperties.getApplications().contains(serviceId)) {
|
||||
@@ -109,13 +105,9 @@ public class MonitorStatService implements DruidStatServiceMBean {
|
||||
List<ServiceInstance> instances = discoveryClient.getInstances(service);
|
||||
for (ServiceInstance instance : instances) {
|
||||
String host = instance.getHost();
|
||||
String instanceId = instance.getInstanceId();
|
||||
if (instanceId == null) {
|
||||
instanceId = instance.getMetadata().get("nacos.instanceId").replaceAll("#", "-").replaceAll("@@",
|
||||
"-");
|
||||
}
|
||||
int port = instance.getPort();
|
||||
String serviceId = instance.getServiceId();
|
||||
String instanceId = String.format("%s_%s", host, port);
|
||||
// 根据前端参数采集指定的服务
|
||||
if (serviceId.equals(requestServiceName)) {
|
||||
ServiceNode serviceNode = new ServiceNode();
|
||||
@@ -492,4 +484,4 @@ public class MonitorStatService implements DruidStatServiceMBean {
|
||||
return array.subList(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
||||
@@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ public class LeaveBill extends Model<LeaveBill> {
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private Integer tenantId;
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 主键值
|
||||
|
||||
@@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
||||
@@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
||||
@@ -6,6 +6,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
|
||||
@@ -8,6 +8,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
|
||||
@@ -38,4 +40,4 @@ auth:
|
||||
|
||||
sentinel:
|
||||
dashboard:
|
||||
version: @project.version@
|
||||
version: @project.version@
|
||||
@@ -9,6 +9,8 @@ spring:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pigx-register}:${NACOS_PORT:8848}
|
||||
metadata:
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
<module>pigx-common</module>
|
||||
<module>pigx-visual</module>
|
||||
<module>pigx-app-server</module>
|
||||
</modules>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
@@ -292,6 +292,8 @@
|
||||
<properties>
|
||||
<!-- 环境标识,需要与配置文件的名称相对应 -->
|
||||
<profiles.active>dev</profiles.active>
|
||||
<nacos.username>nacos</nacos.username>
|
||||
<nacos.password>nacos</nacos.password>
|
||||
</properties>
|
||||
<activation>
|
||||
<!-- 默认环境 -->
|
||||
|
||||
Reference in new issue
Block a user