Browse Source

修复测试环境积木报表和magic-api权限问题。

master
刘忱 2 years ago
parent
commit
b10bc47827
  1. 2
      win-framework/win-spring-boot-starter-security/src/main/java/com/win/framework/security/config/WinWebSecurityConfigurerAdapter.java
  2. 3
      win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/framework/security/config/SecurityConfiguration.java
  3. 52
      win-server/src/main/resources/application.yaml
  4. 22
      win-server/src/main/resources/magic-editor-config.js

2
win-framework/win-spring-boot-starter-security/src/main/java/com/win/framework/security/config/WinWebSecurityConfigurerAdapter.java

@ -131,8 +131,6 @@ public class WinWebSecurityConfigurerAdapter {
//.antMatchers("/captcha/captchaImage").permitAll()
// 1.6 webSocket 允许匿名访问
.antMatchers("/websocket/message").permitAll()
// 1.7 magic-api 允许匿名访问
.antMatchers("/magic/web/**").anonymous()
// ②:每个项目的自定义规则
.and().authorizeRequests(registry -> // 下面,循环设置自定义规则
authorizeRequestsCustomizers.forEach(customizer -> customizer.customize(registry)))

3
win-module-infra/win-module-infra-biz/src/main/java/com/win/module/infra/framework/security/config/SecurityConfiguration.java

@ -39,6 +39,9 @@ public class SecurityConfiguration {
// Spring Boot Admin Server 的安全配置
registry.antMatchers(adminSeverContextPath).anonymous()
.antMatchers(adminSeverContextPath + "/**").anonymous();
// magic-api 允许匿名访问
registry.antMatchers("/magic/web/**").anonymous()
.antMatchers("/magic-api/**").anonymous();
// 文件读取
registry.antMatchers(buildAdminApi("/infra/file/*/get/**")).permitAll();
}

52
win-server/src/main/resources/application.yaml

@ -146,6 +146,7 @@ win:
- /admin-api/system/captcha/captchaImage # 校验图片验证码,和租户无关
- /admin-api/infra/file/*/get/** # 获取图片,和租户无关
- /magic/web/* # magic-api 和租户无关
- /magic-api/* # magic-api 和租户无关
ignore-tables:
- system_tenant
- system_tenant_package
@ -207,9 +208,50 @@ minidao :
# magic-api配置
magic-api:
#配置web页面入口
web: /magic/web
resource:
type: database # 配置接口存储方式,这里选择存在数据库中
table-name: magic_api_file_v2 # 数据库中的表名
prefix: /magic-api # 前缀
location: classpath:magic-api
resource: #配置存储方式
type: database # 配置存储在数据库中
tableName: magic_api_file # 数据库中的表名
# datasource: master #指定数据源(单数据源时无需配置,多数据源时默认使用主数据源,如果存在其他数据源中需要指定。)
prefix: /magic-api # key前缀
readonly: false # 是否是只读模式
# security: # 安全配置
# username: admin # 登录用的用户名
# password: 123456 # 登录用的密码
prefix: /magic-api
editor-config: classpath:./magic-editor-config.js #编辑器配置
date-pattern: # 配置请求参数支持的日期格式
- yyyy-MM-dd
- yyyy-MM-dd HH:mm:ss
- yyyyMMddHHmmss
- yyyyMMdd
response: |- #配置JSON格式,格式为magic-script中的表达式
{
code: code,
msg: message,
data,
timestamp,
requestTime,
executeTime,
}
response-code:
success: 0 #执行成功的code值
invalid: 10400 #参数验证未通过的code值
exception: 10500 #执行出现异常的code值
backup: #备份相关配置
enable: true #是否启用
max-history: -1 #备份保留天数,-1为永久保留
table-name: magic_api_backup #使用数据库存储备份时的表名
crud: # CRUD相关配置
logic-delete-column: delete_mark #逻辑删除列
logic-delete-value: 1 #逻辑删除值
page:
size: size # 页大小的参数名称
page: limit # 页码的参数名称
default-page: 1 # 未传页码时的默认首页
default-size: 10 # 未传页大小时的默认页大小
debug:
timeout: 60 # 断点超时时间,默认60s
throw-exception: true # 执行出错时,异常将抛出处理
auto-import-module: db,http,log,request,response,env,magic #自动导入模块

22
win-server/src/main/resources/magic-editor-config.js

@ -0,0 +1,22 @@
var MAGIC_EDITOR_CONFIG = {
title: 'Learun Admin Web IDE',
header: {
skin: true, // 屏蔽皮肤按钮
document: false, // 屏蔽文档按钮
repo: false, // 屏蔽gitee和github
qqGroup: false // 屏蔽加入QQ群
},
// 其它配置参考本页中其它配置项
request: {
beforeSend: function (config) {
console.log('请求设置', localStorage["ACCESS_TOKEN"]);
config.headers.Authorization = "Bearer " + "9f953a2e801245d081a08353c79d2c27";
config.headers['Tenant-Id'] = "1";
return config;
},
onError: function (err) {
// console.log('请求出错');
return Promise.reject(err)
}
},
}
Loading…
Cancel
Save