Merge remote-tracking branch 'origin/leng_dev' into fxz_dev

This commit is contained in:
付绪壮 committed 2022-04-18 17:48:37 +08:00
commit cc5e314c2b
98 files changed
+17720 -588

No files matched your search

+2 -2
View File
@@ -20,8 +20,8 @@
<pigx.version>4.3.0</pigx.version>
<mybatis-plus.version>3.5.1</mybatis-plus.version>
<dynamic-ds.version>3.4.1</dynamic-ds.version>
<druid.version>1.2.8</druid.version>
<hutool.version>5.7.21</hutool.version>
<druid.version>1.2.9</druid.version>
<hutool.version>5.7.22</hutool.version>
<mysql.connector.version>8.0.27</mysql.connector.version>
<oracle.version>21.3.0.0</oracle.version>
<sqlserver.version>8.4.1.jre8</sqlserver.version>
@@ -95,4 +95,9 @@ public interface CacheConstants {
*/
String CLIENT_FLAG = "client_config_flag";
/**
* 登录错误次数
*/
String LOGIN_ERROR_TIMES = "login_error_times";
}
@@ -29,6 +29,8 @@ import com.pig4cloud.pigx.common.data.datascope.PigxDefaultDatascopeHandle;
import com.pig4cloud.pigx.common.data.resolver.SqlFilterArgumentResolver;
import com.pig4cloud.pigx.common.data.tenant.PigxTenantHandler;
import com.pig4cloud.pigx.common.security.service.PigxUser;
import org.apache.ibatis.mapping.DatabaseIdProvider;
import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
@@ -42,6 +44,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import javax.sql.DataSource;
import java.util.List;
import java.util.Properties;
/**
* @author lengleng
@@ -133,4 +136,17 @@ public class MybatisPlusConfiguration implements WebMvcConfigurer {
return new MybatisPlusMetaObjectHandler();
}
/**
* 数据库方言配置
* @return
*/
@Bean
public DatabaseIdProvider databaseIdProvider() {
VendorDatabaseIdProvider databaseIdProvider = new VendorDatabaseIdProvider();
Properties properties = new Properties();
properties.setProperty("SQL Server", "mssql");
databaseIdProvider.setProperties(properties);
return databaseIdProvider;
}
}
@@ -17,6 +17,7 @@
package com.pig4cloud.pigx.common.security.listener;
import cn.hutool.core.collection.CollUtil;
import com.pig4cloud.pigx.common.security.handler.AuthenticationFailureHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
@@ -29,6 +30,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @author lengleng
@@ -37,7 +39,7 @@ import javax.servlet.http.HttpServletResponse;
public class AuthenticationFailureEventListener implements ApplicationListener<AbstractAuthenticationFailureEvent> {
@Autowired(required = false)
private AuthenticationFailureHandler failureHandler;
private List<AuthenticationFailureHandler> failureHandlerList;
/**
* Handle an application event.
@@ -58,9 +60,10 @@ public class AuthenticationFailureEventListener implements ApplicationListener<A
AuthenticationException authenticationException = event.getException();
Authentication authentication = (Authentication) event.getSource();
// 调用自定义业务实现
if (failureHandler != null) {
failureHandler.handle(authenticationException, authentication, request, response);
// 调用自定义业务链实现
if (CollUtil.isNotEmpty(failureHandlerList)) {
failureHandlerList.forEach(failureHandler -> failureHandler.handle(authenticationException, authentication,
request, response));
}
}
@@ -29,6 +29,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* @author lengleng
@@ -37,7 +38,7 @@ import javax.servlet.http.HttpServletResponse;
public class AuthenticationSuccessEventListener implements ApplicationListener<AuthenticationSuccessEvent> {
@Autowired(required = false)
private AuthenticationSuccessHandler successHandler;
private List<AuthenticationSuccessHandler> successHandlerList;
/**
* Handle an application event.
@@ -46,13 +47,12 @@ public class AuthenticationSuccessEventListener implements ApplicationListener<A
@Override
public void onApplicationEvent(AuthenticationSuccessEvent event) {
Authentication authentication = (Authentication) event.getSource();
if (successHandler != null && isUserAuthentication(authentication)) {
if (CollUtil.isNotEmpty(successHandlerList) && isUserAuthentication(authentication)) {
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder
.getRequestAttributes();
HttpServletRequest request = requestAttributes.getRequest();
HttpServletResponse response = requestAttributes.getResponse();
successHandler.handle(authentication, request, response);
successHandlerList.forEach(successHandler -> successHandler.handle(authentication, request, response));
}
}
@@ -15,7 +15,7 @@ import org.springframework.context.annotation.Configuration;
* @author hccake
*/
@ConditionalOnProperty(prefix = WebSocketProperties.PREFIX, name = "message-distributor",
havingValue = MessageDistributorTypeConstants.LOCAL, matchIfMissing = true)
havingValue = MessageDistributorTypeConstants.LOCAL)
@Configuration(proxyBeanMethods = false)
@RequiredArgsConstructor
public class LocalMessageDistributorConfig {
@@ -22,7 +22,7 @@ import org.springframework.data.redis.listener.RedisMessageListenerContainer;
*/
@ConditionalOnClass(StringRedisTemplate.class)
@ConditionalOnProperty(prefix = WebSocketProperties.PREFIX, name = "message-distributor",
havingValue = MessageDistributorTypeConstants.REDIS)
havingValue = MessageDistributorTypeConstants.REDIS, matchIfMissing = true)
@Configuration(proxyBeanMethods = false)
@RequiredArgsConstructor
public class RedisMessageDistributorConfig {