Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
pig_冷冷
Pig
比较版本
29fdaec8d9f4b0219db5bff597028f32727c4e21...7e37a5d59e85b9164bfafcbbf1e01fb9db3ab801
Pig
项目概览
pig_冷冷
/
Pig
上一次同步 10 个月
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Pig
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
源分支
7e37a5d59e85b9164bfafcbbf1e01fb9db3ab801
选择Git版本
...
目标分支
29fdaec8d9f4b0219db5bff597028f32727c4e21
选择Git版本
比较
Commits (8)
https://gitcode.net/qq_16063307/pig/-/commit/1472ee11af1a53720a98632ede39a72726e8d852
:bug: Fixing a bug. 修复【字段管理】页面的【字典类型】过滤条件不生效
2023-06-27T10:39:29+08:00
lbw
wangiegie@163.com
https://gitcode.net/qq_16063307/pig/-/commit/71ae555bda81303ab2761e5c5200b8998051756d
适配jdk17版本下的配置变更
2023-07-03T06:46:08+00:00
黑码
xiaobaogeit@163.com
Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:xiaobaogeit@163.com" title="xiaobaogeit@163.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg2" style="text-decoration: none">N</a><a href="mailto:xiaobaogeit@163.com" title="xiaobaogeit@163.com">黑码</a> <<a href="mailto:xiaobaogeit@163.com" title="xiaobaogeit@163.com">xiaobaogeit@163.com</a>></span>
https://gitcode.net/qq_16063307/pig/-/commit/8511dda09d02513f0f55c04449cec2904295dfcd
!380 适配jdk17版本下的配置变更
2023-07-03T07:15:29+00:00
lengleng
wangiegie@gmail.com
Merge pull request !380 from 黑码/jdk17-dev
https://gitcode.net/qq_16063307/pig/-/commit/cd71b6e7c344d7741c4447156d8f5418fcce6903
refactor(monitor): 更新spring security 安全策略的写法
2023-07-05T19:06:57+08:00
ZN_nick
znnznick@gmail.com
更新spring security 安全策略的写法。移除使用废弃的方法,采用官方推荐的写法重构。
https://gitcode.net/qq_16063307/pig/-/commit/c990a47c753c09e9b79ef18a921abb38f8ee8004
Merge branch 'jdk17' into jdk17-dev
2023-07-05T19:15:51+08:00
ZN_nick
znnznick@gmail.com
https://gitcode.net/qq_16063307/pig/-/commit/ac206f6b908ab204b609ed6d472a5cfa96f1ba83
:refactor: 更新spring security安全策略写法
2023-07-06T15:15:49+08:00
ZN_nick
znnznick@gmail.com
https://gitcode.net/qq_16063307/pig/-/commit/5d329647a6d7eec1a35267e24628b4da3154ac5e
:style:格式化代码
2023-07-06T15:16:15+08:00
ZN_nick
znnznick@gmail.com
https://gitcode.net/qq_16063307/pig/-/commit/7e37a5d59e85b9164bfafcbbf1e01fb9db3ab801
!381 更新spring security安全策略写法
2023-07-07T00:24:30+00:00
lbw
wangiegie@163.com
Merge pull request !381 from ZN_nick/jdk17-dev
隐藏空白更改
内联
并排
Showing
10 changed file
with
75 addition
and
98 deletion
+75
-98
db/pig_config.sql
db/pig_config.sql
+1
-1
pig-auth/src/main/java/com/pig4cloud/pig/auth/config/AuthorizationServerConfiguration.java
...oud/pig/auth/config/AuthorizationServerConfiguration.java
+4
-7
pig-auth/src/main/java/com/pig4cloud/pig/auth/config/WebSecurityConfiguration.java
...m/pig4cloud/pig/auth/config/WebSecurityConfiguration.java
+5
-12
pig-auth/src/main/java/com/pig4cloud/pig/auth/support/core/FormIdentityLoginConfigurer.java
...ud/pig/auth/support/core/FormIdentityLoginConfigurer.java
+5
-7
pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PigResourceServerConfiguration.java
...on/security/component/PigResourceServerConfiguration.java
+2
-6
pig-common/pig-common-swagger/src/main/java/com/pig4cloud/pig/common/swagger/annotation/EnablePigDoc.java
...pig4cloud/pig/common/swagger/annotation/EnablePigDoc.java
+11
-13
pig-common/pig-common-swagger/src/main/java/com/pig4cloud/pig/common/swagger/config/OpenAPIDefinitionImportSelector.java
...ommon/swagger/config/OpenAPIDefinitionImportSelector.java
+15
-15
pig-common/pig-common-swagger/src/main/java/com/pig4cloud/pig/common/swagger/config/OpenAPIMetadataRegister.java
...ud/pig/common/swagger/config/OpenAPIMetadataRegister.java
+12
-13
pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/DictController.java
...va/com/pig4cloud/pig/admin/controller/DictController.java
+4
-2
pig-visual/pig-monitor/src/main/java/com/pig4cloud/pig/monitor/config/WebSecurityConfigurer.java
...m/pig4cloud/pig/monitor/config/WebSecurityConfigurer.java
+16
-22
未找到文件。
db/pig_config.sql
浏览文件 @
7e37a5d5
...
...
@@ -37,7 +37,7 @@ CREATE TABLE `config_info` (
-- Records of config_info
-- ----------------------------
BEGIN
;
INSERT
INTO
`config_info`
VALUES
(
1
,
'application-dev.yml'
,
'DEFAULT_GROUP'
,
'#
配置文件加密根密码
\n
jasypt:
\n
encryptor:
\n
password: pig
\n
algorithm: PBEWithMD5AndDES
\n
iv-generator-classname: org.jasypt.iv.NoIvGenerator
\n
\n
# Spring 相关
\n
spring:
\n
cache:
\n
type: redis
\n
redis:
\n
host: pig-redis
\n
cloud:
\n
sentinel:
\n
eager: true
\n
transport:
\n
dashboard: pig-sentinel:5003
\n\n
# 暴露监控端点
\n
management:
\n
endpoints:
\n
web:
\n
exposure:
\n
include:
\"
*
\"
\n
endpoint:
\n
health:
\n
show-details: ALWAYS
\n\n\n
# feign 配置
\n
feign:
\n
sentinel:
\n
enabled: true
\n
okhttp:
\n
enabled: true
\n
httpclient:
\n
enabled: false
\n
client:
\n
config:
\n
default:
\n
connectTimeout: 10000
\n
readTimeout: 10000
\n
compression:
\n
request:
\n
enabled: true
\n
response:
\n
enabled: true
\n\n
# mybaits-plus配置
\n
mybatis-plus:
\n
mapper-locations: classpath:/mapper/*Mapper.xml
\n
global-config:
\n
banner: false
\n
db-config:
\n
id-type: auto
\n
table-underline: true
\n
logic-delete-value: 1
\n
logic-not-delete-value: 0
\n
configuration:
\n
map-underscore-to-camel-case: true
\n\n
# swagger 配置
\n
swagger:
\n
enabled: true
\n
title: Pig Swagger API
\n
gateway: http://${GATEWAY_HOST:pig-gateway}:${GATEWAY-PORT:9999}
\n
token-url: ${swagger.gateway}/auth/oauth2/token
\n
scope: server'
,
'c9b41bce3b5ce5802d6592cab001f791'
,
'2022-05-08 12:10:37'
,
'2023-05-26 13:57:59'
,
'nacos'
,
'127.0.0.1
'
,
''
,
''
,
''
,
''
,
''
,
'yaml'
,
''
,
''
);
INSERT
INTO
`config_info`
VALUES
(
1
,
'application-dev.yml'
,
'DEFAULT_GROUP'
,
'#
加解密根密码
\n
jasypt:
\n
encryptor:
\n
password: pig
\n
algorithm: PBEWithMD5AndDES
\n
iv-generator-classname: org.jasypt.iv.NoIvGenerator
\n
\n
# Spring 相关
\n
spring:
\n
cache:
\n
type: redis
\n
data:
\n
redis:
\n
host: pig-redis
\n
cloud:
\n
openfeign:
\n
circuitbreaker:
\n
enabled: true
\n
okhttp:
\n
enabled: true
\n
httpclient:
\n
enabled: false
\n
client:
\n
config:
\n
default:
\n
connectTimeout: 10000
\n
readTimeout: 10000
\n
compression:
\n
request:
\n
enabled: true
\n
response:
\n
enabled: true
\n
sentinel:
\n
eager: true
\n
transport:
\n
dashboard: pig-sentinel:5003
\n\n
# 暴露监控端点
\n
management:
\n
endpoints:
\n
web:
\n
exposure:
\n
include: "*"
\n
endpoint:
\n
health:
\n
show-details: ALWAYS
\n\n\n
# feign 配置
\n
feign:
\n
sentinel:
\n
enabled: true
\n\n
# mybaits-plus配置
\n
mybatis-plus:
\n
mapper-locations: classpath:/mapper/*Mapper.xml
\n
global-config:
\n
banner: false
\n
db-config:
\n
id-type: auto
\n
table-underline: true
\n
logic-delete-value: 1
\n
logic-not-delete-value: 0
\n
configuration:
\n
map-underscore-to-camel-case: true
\n\n
# spring security 配置
\n
security:
\n
oauth2:
\n
# 通用放行URL,服务个性化,请在对应配置文件覆盖
\n
ignore:
\n
urls:
\n
- /v3/api-docs
\n
- /actuator/**
\n\n
# swagger 配置
\n
swagger:
\n
enabled: true
\n
title: Pig Swagger API
\n
gateway: http://${GATEWAY_HOST:pig-gateway}:${GATEWAY-PORT:9999}
\n
token-url: ${swagger.gateway}/auth/oauth2/token
\n
scope: server
\n
services:
\n
pig-upms-biz: admin
\n
pig-codegen: gen'
,
'f50c1d2af7bf5b5416275e4949258f91'
,
'2022-05-08 12:10:37'
,
'2023-07-03 06:35:05'
,
'nacos'
,
'192.168.3.2
'
,
''
,
''
,
''
,
''
,
''
,
'yaml'
,
''
,
''
);
INSERT
INTO
`config_info`
VALUES
(
2
,
'pig-auth-dev.yml'
,
'DEFAULT_GROUP'
,
'# 数据源
\n
spring:
\n
freemarker:
\n
allow-request-override: false
\n
allow-session-override: false
\n
cache: true
\n
charset: UTF-8
\n
check-template-location: true
\n
content-type: text/html
\n
enabled: true
\n
expose-request-attributes: false
\n
expose-session-attributes: false
\n
expose-spring-macro-helpers: true
\n
prefer-file-system-access: true
\n
suffix: .ftl
\n
template-loader-path: classpath:/templates/'
,
'74f53b71c7799aa754da75662378b93c'
,
'2022-05-08 12:10:37'
,
'2022-06-04 14:15:35'
,
'nacos'
,
'127.0.0.1'
,
''
,
''
,
''
,
''
,
''
,
'yaml'
,
''
,
''
);
INSERT
INTO
`config_info`
VALUES
(
3
,
'pig-codegen-dev.yml'
,
'DEFAULT_GROUP'
,
'## spring security 配置1
\n
security:
\n
oauth2:
\n
client:
\n
client-id: ENC(27v1agvAug87ANOVnbKdsw==)
\n
client-secret: ENC(VbnkopxrwgbFVKp+UxJ2pg==)
\n
scope: server
\n\n
# 数据源配置
\n
spring:
\n
datasource:
\n
type: com.zaxxer.hikari.HikariDataSource
\n
driver-class-name: com.mysql.cj.jdbc.Driver
\n
username: root
\n
password: root
\n
url: jdbc:mysql://pig-mysql:3306/pig_codegen?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
\n
resources:
\n
static-locations: classpath:/static/,classpath:/views/
\n
'
,
'6c6e48b793671dc2a0adffe2e2c27fb0'
,
'2022-05-08 12:10:37'
,
'2022-12-15 23:05:35'
,
'nacos'
,
'127.0.0.1'
,
''
,
''
,
''
,
''
,
''
,
'yaml'
,
''
,
''
);
INSERT
INTO
`config_info`
VALUES
(
4
,
'pig-gateway-dev.yml'
,
'DEFAULT_GROUP'
,
'spring:
\n
cloud:
\n
gateway:
\n
locator:
\n
enabled: true
\n
routes:
\n
# 认证中心
\n
- id: pig-auth
\n
uri: lb://pig-auth
\n
predicates:
\n
- Path=/auth/**
\n
filters:
\n
# 验证码处理
\n
- ValidateCodeGatewayFilter
\n
# 前端密码解密
\n
- PasswordDecoderFilter
\n
#UPMS 模块
\n
- id: pig-upms-biz
\n
uri: lb://pig-upms-biz
\n
predicates:
\n
- Path=/admin/**
\n
filters:
\n
# 限流配置
\n
- name: RequestRateLimiter
\n
args:
\n
key-resolver:
\'
#{@remoteAddrKeyResolver}
\'\n
redis-rate-limiter.replenishRate: 100
\n
redis-rate-limiter.burstCapacity: 200
\n
# 代码生成模块
\n
- id: pig-codegen
\n
uri: lb://pig-codegen
\n
predicates:
\n
- Path=/gen/**
\n
# 固定路由转发配置 无修改
\n
- id: openapi
\n
uri: lb://pig-gateway
\n
predicates:
\n
- Path=/v3/api-docs/**
\n
filters:
\n
- RewritePath=/v3/api-docs/(?<path>.*), /$
\\
{path}/$
\\
{path}/v3/api-docs
\n\n
gateway:
\n
encode-key:
\'
thanks,pig4cloud
\'\n
ignore-clients:
\n
- test
\n
- client'
,
'000988cf0102382d3f23df35027b47fd'
,
'2022-05-08 12:10:37'
,
'2022-06-07 14:00:11'
,
'nacos'
,
'127.0.0.1'
,
''
,
''
,
''
,
''
,
''
,
'yaml'
,
''
,
''
);
...
...
pig-auth/src/main/java/com/pig4cloud/pig/auth/config/AuthorizationServerConfiguration.java
浏览文件 @
7e37a5d5
...
...
@@ -74,19 +74,16 @@ public class AuthorizationServerConfiguration {
.
authorizationEndpoint
(
authorizationEndpoint
->
authorizationEndpoint
// 授权码端点个性化confirm页面
.
consentPage
(
SecurityConstants
.
CUSTOM_CONSENT_PAGE_URI
)));
DefaultSecurityFilterChain
securityFilterChain
=
http
.
authorizeHttpRequests
(
authorizeRequests
->
{
http
.
authorizeHttpRequests
(
authorizeRequests
->
{
// 自定义接口、端点暴露
authorizeRequests
.
requestMatchers
(
"/token/**"
,
"/actuator/**"
,
"/css/**"
,
"/error"
).
permitAll
();
authorizeRequests
.
anyRequest
().
authenticated
();
})
.
apply
(
authorizationServerConfigurer
.
authorizationService
(
authorizationService
)
// redis存储token的实现
.
authorizationServerSettings
(
AuthorizationServerSettings
.
builder
().
issuer
(
SecurityConstants
.
PROJECT_LICENSE
).
build
()))
// 授权码登录的登录页个性化
.
and
()
.
apply
(
new
FormIdentityLoginConfigurer
())
.
and
()
.
build
();
AuthorizationServerSettings
.
builder
().
issuer
(
SecurityConstants
.
PROJECT_LICENSE
).
build
()));
http
.
apply
(
new
FormIdentityLoginConfigurer
());
DefaultSecurityFilterChain
securityFilterChain
=
http
.
build
();
// 注入自定义授权模式实现
addCustomOAuth2GrantAuthenticationProvider
(
http
);
...
...
pig-auth/src/main/java/com/pig4cloud/pig/auth/config/WebSecurityConfiguration.java
浏览文件 @
7e37a5d5
...
...
@@ -44,12 +44,8 @@ public class WebSecurityConfiguration {
http
.
authorizeHttpRequests
(
authorizeRequests
->
authorizeRequests
.
requestMatchers
(
"/token/*"
)
.
permitAll
()
// 开放自定义的部分端点
.
anyRequest
()
.
authenticated
())
.
headers
()
.
frameOptions
()
.
sameOrigin
()
// 避免iframe同源无法登录
.
and
()
.
apply
(
new
FormIdentityLoginConfigurer
());
// 表单登录个性化
.
authenticated
()).
headers
(
header
->
header
.
frameOptions
(
frameOption
->
frameOption
.
sameOrigin
())
// 避免iframe同源无法登录许iframe
).
apply
(
new
FormIdentityLoginConfigurer
());
// 表单登录个性化
// 处理 UsernamePasswordAuthenticationToken
http
.
authenticationProvider
(
new
PigDaoAuthenticationProvider
());
return
http
.
build
();
...
...
@@ -68,12 +64,9 @@ public class WebSecurityConfiguration {
SecurityFilterChain
resources
(
HttpSecurity
http
)
throws
Exception
{
http
.
securityMatchers
((
matchers
)
->
matchers
.
requestMatchers
(
"/actuator/**"
,
"/css/**"
,
"/error"
))
.
authorizeHttpRequests
((
authorize
)
->
authorize
.
anyRequest
().
permitAll
())
.
requestCache
()
.
disable
()
.
securityContext
()
.
disable
()
.
sessionManagement
()
.
disable
();
.
requestCache
(
cache
->
cache
.
disable
())
.
securityContext
((
securityContext
)
->
securityContext
.
disable
())
.
sessionManagement
(
sessionManagement
->
sessionManagement
.
disable
());
return
http
.
build
();
}
...
...
pig-auth/src/main/java/com/pig4cloud/pig/auth/support/core/FormIdentityLoginConfigurer.java
浏览文件 @
7e37a5d5
...
...
@@ -22,13 +22,11 @@ public final class FormIdentityLoginConfigurer
formLogin
.
failureHandler
(
new
FormAuthenticationFailureHandler
());
})
.
logout
()
// SSO登出成功处理
.
logoutSuccessHandler
(
new
SsoLogoutSuccessHandler
())
.
deleteCookies
(
"JSESSIONID"
)
.
invalidateHttpSession
(
true
)
.
and
()
.
csrf
()
.
disable
();
.
logout
(
logout
->
logout
.
logoutSuccessHandler
(
new
SsoLogoutSuccessHandler
())
.
deleteCookies
(
"JSESSIONID"
)
.
invalidateHttpSession
(
true
))
// SSO登出成功处理
.
csrf
(
csrf
->
csrf
.
disable
());
}
}
pig-common/pig-common-security/src/main/java/com/pig4cloud/pig/common/security/component/PigResourceServerConfiguration.java
浏览文件 @
7e37a5d5
...
...
@@ -59,12 +59,8 @@ public class PigResourceServerConfiguration {
oauth2
->
oauth2
.
opaqueToken
(
token
->
token
.
introspector
(
customOpaqueTokenIntrospector
))
.
authenticationEntryPoint
(
resourceAuthExceptionEntryPoint
)
.
bearerTokenResolver
(
pigBearerTokenExtractor
))
.
headers
()
.
frameOptions
()
.
disable
()
.
and
()
.
csrf
()
.
disable
();
.
headers
(
headers
->
headers
.
frameOptions
(
frame
->
frame
.
disable
()))
.
csrf
(
csrf
->
csrf
.
disable
());
return
http
.
build
();
}
...
...
pig-common/pig-common-swagger/src/main/java/com/pig4cloud/pig/common/swagger/annotation/EnablePigDoc.java
浏览文件 @
7e37a5d5
...
...
@@ -29,7 +29,7 @@ import java.lang.annotation.*;
* @author lengleng
* @date 2022-03-26
*/
@Target
({
ElementType
.
TYPE
})
@Target
({
ElementType
.
TYPE
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
@Inherited
...
...
@@ -37,18 +37,16 @@ import java.lang.annotation.*;
@Import
(
OpenAPIDefinitionImportSelector
.
class
)
public
@interface
EnablePigDoc
{
/**
* 网关路由前缀
*
* @return String
*/
String
value
();
/**
* 网关路由前缀
* @return String
*/
String
value
();
/**
* 是否是微服务架构
*
* @return true
*/
boolean
isMicro
()
default
true
;
/**
* 是否是微服务架构
* @return true
*/
boolean
isMicro
()
default
true
;
}
pig-common/pig-common-swagger/src/main/java/com/pig4cloud/pig/common/swagger/config/OpenAPIDefinitionImportSelector.java
浏览文件 @
7e37a5d5
...
...
@@ -17,25 +17,25 @@ import java.util.Objects;
*/
public
class
OpenAPIDefinitionImportSelector
implements
ImportBeanDefinitionRegistrar
{
@Override
public
void
registerBeanDefinitions
(
AnnotationMetadata
metadata
,
BeanDefinitionRegistry
registry
)
{
@Override
public
void
registerBeanDefinitions
(
AnnotationMetadata
metadata
,
BeanDefinitionRegistry
registry
)
{
Map
<
String
,
Object
>
annotationAttributes
=
metadata
.
getAnnotationAttributes
(
EnablePigDoc
.
class
.
getName
(),
true
);
Object
value
=
annotationAttributes
.
get
(
"value"
);
if
(
Objects
.
isNull
(
value
))
{
return
;
}
Map
<
String
,
Object
>
annotationAttributes
=
metadata
.
getAnnotationAttributes
(
EnablePigDoc
.
class
.
getName
(),
true
);
Object
value
=
annotationAttributes
.
get
(
"value"
);
if
(
Objects
.
isNull
(
value
))
{
return
;
}
BeanDefinitionBuilder
openAPIMetadataRegister
=
BeanDefinitionBuilder
.
genericBeanDefinition
(
OpenAPIMetadataRegister
.
class
);
openAPIMetadataRegister
.
addPropertyValue
(
"path"
,
value
);
BeanDefinitionBuilder
openAPIMetadataRegister
=
BeanDefinitionBuilder
.
genericBeanDefinition
(
OpenAPIMetadataRegister
.
class
);
openAPIMetadataRegister
.
addPropertyValue
(
"path"
,
value
);
registry
.
registerBeanDefinition
(
"openAPIMetadataRegister"
,
openAPIMetadataRegister
.
getBeanDefinition
());
registry
.
registerBeanDefinition
(
"openAPIMetadataRegister"
,
openAPIMetadataRegister
.
getBeanDefinition
());
BeanDefinitionBuilder
openAPIDefinition
=
BeanDefinitionBuilder
.
genericBeanDefinition
(
OpenAPIDefinition
.
class
);
openAPIDefinition
.
addPropertyValue
(
"path"
,
value
);
registry
.
registerBeanDefinition
(
"openAPIDefinition"
,
openAPIDefinition
.
getBeanDefinition
());
BeanDefinitionBuilder
openAPIDefinition
=
BeanDefinitionBuilder
.
genericBeanDefinition
(
OpenAPIDefinition
.
class
);
openAPIDefinition
.
addPropertyValue
(
"path"
,
value
);
registry
.
registerBeanDefinition
(
"openAPIDefinition"
,
openAPIDefinition
.
getBeanDefinition
());
}
}
}
pig-common/pig-common-swagger/src/main/java/com/pig4cloud/pig/common/swagger/config/OpenAPIMetadataRegister.java
浏览文件 @
7e37a5d5
...
...
@@ -13,21 +13,20 @@ import org.springframework.context.ApplicationContextAware;
*/
public
class
OpenAPIMetadataRegister
implements
InitializingBean
,
ApplicationContextAware
{
private
ApplicationContext
applicationContext
;
private
ApplicationContext
applicationContext
;
@Setter
private
String
path
;
@Setter
private
String
path
;
@Override
public
void
afterPropertiesSet
()
{
ServiceInstance
serviceInstance
=
applicationContext
.
getBean
(
ServiceInstance
.
class
);
serviceInstance
.
getMetadata
().
put
(
"spring-doc"
,
path
);
}
@Override
public
void
afterPropertiesSet
()
{
ServiceInstance
serviceInstance
=
applicationContext
.
getBean
(
ServiceInstance
.
class
);
serviceInstance
.
getMetadata
().
put
(
"spring-doc"
,
path
);
}
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
this
.
applicationContext
=
applicationContext
;
}
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
this
.
applicationContext
=
applicationContext
;
}
}
pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/DictController.java
浏览文件 @
7e37a5d5
...
...
@@ -75,8 +75,10 @@ public class DictController {
*/
@GetMapping
(
"/page"
)
public
R
<
IPage
<
SysDict
>>
getDictPage
(
Page
page
,
SysDict
sysDict
)
{
return
R
.
ok
(
sysDictService
.
page
(
page
,
Wrappers
.<
SysDict
>
lambdaQuery
()
.
like
(
StrUtil
.
isNotBlank
(
sysDict
.
getDictKey
()),
SysDict:
:
getDictKey
,
sysDict
.
getDictKey
())));
return
R
.
ok
(
sysDictService
.
page
(
page
,
Wrappers
.<
SysDict
>
lambdaQuery
()
.
like
(
StrUtil
.
isNotBlank
(
sysDict
.
getDictKey
()),
SysDict:
:
getDictKey
,
sysDict
.
getDictKey
())
.
eq
(
StrUtil
.
isNotBlank
(
sysDict
.
getSystemFlag
()),
SysDict:
:
getSystemFlag
,
sysDict
.
getSystemFlag
())));
}
/**
...
...
pig-visual/pig-monitor/src/main/java/com/pig4cloud/pig/monitor/config/WebSecurityConfigurer.java
浏览文件 @
7e37a5d5
...
...
@@ -18,11 +18,16 @@ package com.pig4cloud.pig.monitor.config;
import
de.codecentric.boot.admin.server.config.AdminServerProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.security.config.Customizer
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
;
import
org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer
;
import
org.springframework.security.config.annotation.web.configurers.HeadersConfigurer
;
import
org.springframework.security.web.SecurityFilterChain
;
import
org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler
;
import
static
org
.
springframework
.
security
.
config
.
Customizer
.
withDefaults
;
/**
* WebSecurityConfigurer
*
...
...
@@ -49,28 +54,17 @@ public class WebSecurityConfigurer {
SavedRequestAwareAuthenticationSuccessHandler
successHandler
=
new
SavedRequestAwareAuthenticationSuccessHandler
();
successHandler
.
setTargetUrlParameter
(
"redirectTo"
);
successHandler
.
setDefaultTargetUrl
(
adminContextPath
+
"/"
);
http
.
headers
()
.
frameOptions
()
.
disable
()
.
and
()
.
authorizeHttpRequests
()
.
requestMatchers
(
adminContextPath
+
"/assets/**"
,
adminContextPath
+
"/login"
,
adminContextPath
+
"/instances/**"
,
adminContextPath
+
"/actuator/**"
)
.
permitAll
()
.
anyRequest
()
.
authenticated
()
.
and
()
.
formLogin
()
.
loginPage
(
adminContextPath
+
"/login"
)
.
successHandler
(
successHandler
)
.
and
()
.
logout
()
.
logoutUrl
(
adminContextPath
+
"/logout"
)
.
and
()
.
httpBasic
()
.
and
()
.
csrf
()
.
disable
();
http
.
headers
((
header
)
->
header
.
frameOptions
(
HeadersConfigurer
.
FrameOptionsConfig
::
disable
))
.
authorizeHttpRequests
((
authorize
)
->
authorize
.
requestMatchers
(
adminContextPath
+
"/assets/**"
,
adminContextPath
+
"/login"
,
adminContextPath
+
"/instances/**"
,
adminContextPath
+
"/actuator/**"
)
.
permitAll
()
.
anyRequest
()
.
authenticated
())
.
formLogin
((
formLogin
)
->
formLogin
.
loginPage
(
adminContextPath
+
"/login"
).
successHandler
(
successHandler
))
.
logout
((
logout
)
->
logout
.
logoutUrl
(
adminContextPath
+
"/logout"
))
.
httpBasic
(
withDefaults
())
.
csrf
(
AbstractHttpConfigurer:
:
disable
);
return
http
.
build
();
}
...
...