Merge branch 'leng_dev' of codeup.aliyun.com:pig/pigx/pigx into lei_dev
This commit is contained in:
commit
0843b9d468
8 files changed
+10
-20
No files matched your search
@@ -25,4 +25,5 @@ create database `pigxx_report` default character set utf8mb4 collate utf8mb4_gen
|
||||
-- pigx bi 报表相关的数据库
|
||||
create database `pigxx_bi` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
|
||||
-- pigx app 模块相关的数据库
|
||||
create database `pigxx_app` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
@@ -259,6 +259,7 @@ INSERT INTO `sys_dict_item` VALUES (64, 2, 'DINGTALK', '钉钉', 'social_type',
|
||||
INSERT INTO `sys_dict_item` VALUES (65, 2, 'WEIXIN_CP', '企业微信', 'social_type', '企业微信', 3, ' ', ' ', '2022-02-18 13:56:25', '2022-02-18 13:56:28', NULL, '0', 1);
|
||||
INSERT INTO `sys_dict_item` VALUES (66, 18, '2', 'APP', 'style_type', 'uview风格', 1, ' ', ' ', '2020-02-07 03:53:12', '2020-02-07 03:53:12', '', '0', 1);
|
||||
INSERT INTO `sys_dict_item` VALUES (67, 17, 'mobile', 'app', 'grant_types', 'App登录', 5, 'admin', ' ', '2022-12-09 09:54:49', NULL, NULL, '0', 1);
|
||||
INSERT INTO `sys_dict_item` VALUES (68, 2, 'MINI', '小程序登录', 'social_type', '小程序登录', 3, ' ', ' ', '2022-02-18 13:56:25', '2022-02-18 13:56:28', NULL, '0', 1);
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
server:
|
||||
port: 6060
|
||||
port: 7060
|
||||
|
||||
spring:
|
||||
application:
|
||||
|
||||
+5
-5
@@ -39,7 +39,7 @@ import java.util.regex.Pattern;
|
||||
* 资源服务器对外直接暴露URL,如果设置contex-path 要特殊处理
|
||||
*/
|
||||
@Slf4j
|
||||
@ConfigurationProperties(prefix = "security.oauth2.ignore")
|
||||
@ConfigurationProperties(prefix = "security.oauth2.client")
|
||||
public class PermitAllUrlProperties implements InitializingBean {
|
||||
|
||||
private static final Pattern PATTERN = Pattern.compile("\\{(.*?)\\}");
|
||||
@@ -48,11 +48,11 @@ public class PermitAllUrlProperties implements InitializingBean {
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private List<String> urls = new ArrayList<>();
|
||||
private List<String> ignoreUrls = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
urls.addAll(Arrays.asList(DEFAULT_IGNORE_URLS));
|
||||
ignoreUrls.addAll(Arrays.asList(DEFAULT_IGNORE_URLS));
|
||||
RequestMappingHandlerMapping mapping = SpringContextHolder.getBean("requestMappingHandlerMapping");
|
||||
Map<RequestMappingInfo, HandlerMethod> map = mapping.getHandlerMethods();
|
||||
|
||||
@@ -62,12 +62,12 @@ public class PermitAllUrlProperties implements InitializingBean {
|
||||
// 获取方法上边的注解 替代path variable 为 *
|
||||
Inner method = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), Inner.class);
|
||||
Optional.ofNullable(method).ifPresent(inner -> Objects.requireNonNull(info.getPathPatternsCondition())
|
||||
.getPatternValues().forEach(url -> urls.add(ReUtil.replaceAll(url, PATTERN, "*"))));
|
||||
.getPatternValues().forEach(url -> ignoreUrls.add(ReUtil.replaceAll(url, PATTERN, "*"))));
|
||||
|
||||
// 获取类上边的注解, 替代path variable 为 *
|
||||
Inner controller = AnnotationUtils.findAnnotation(handlerMethod.getBeanType(), Inner.class);
|
||||
Optional.ofNullable(controller).ifPresent(inner -> Objects.requireNonNull(info.getPathPatternsCondition())
|
||||
.getPatternValues().forEach(url -> urls.add(ReUtil.replaceAll(url, PATTERN, "*"))));
|
||||
.getPatternValues().forEach(url -> ignoreUrls.add(ReUtil.replaceAll(url, PATTERN, "*"))));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ public class PigBearerTokenExtractor implements BearerTokenResolver {
|
||||
|
||||
@Override
|
||||
public String resolve(HttpServletRequest request) {
|
||||
boolean match = urlProperties.getUrls().stream()
|
||||
boolean match = urlProperties.getIgnoreUrls().stream()
|
||||
.anyMatch(url -> pathMatcher.match(url, request.getRequestURI()));
|
||||
|
||||
if (match) {
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ public class PigResourceServerConfiguration {
|
||||
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||
|
||||
http.authorizeHttpRequests(authorizeRequests -> authorizeRequests
|
||||
.antMatchers(ArrayUtil.toArray(permitAllUrl.getUrls(), String.class)).permitAll().anyRequest()
|
||||
.antMatchers(ArrayUtil.toArray(permitAllUrl.getIgnoreUrls(), String.class)).permitAll().anyRequest()
|
||||
.authenticated())
|
||||
.oauth2ResourceServer(
|
||||
oauth2 -> oauth2.opaqueToken(token -> token.introspector(customOpaqueTokenIntrospector))
|
||||
|
||||
@@ -73,17 +73,6 @@
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.pig4cloud.plugin</groupId>-->
|
||||
<!-- <artifactId>nacos-datasource-plugin-pg</artifactId>-->
|
||||
<!-- <version>0.0.1-SNAPSHOT</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.postgresql</groupId>-->
|
||||
<!-- <artifactId>postgresql</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@@ -22,7 +22,6 @@ nacos:
|
||||
spring:
|
||||
datasource:
|
||||
platform: mysql #这个过期属性不能修改,nacos 代码对此有硬编码
|
||||
# platform: postgresql #这个过期属性不能修改,nacos 代码对此有硬编码
|
||||
security:
|
||||
enabled: true
|
||||
boot: # 接入 spring boot admin
|
||||
|
||||
Reference in new issue
Block a user