Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

online表单数据源配置,不支持数据库密码加密 #2672

Closed
tuikoushui opened this issue Jun 18, 2021 · 1 comment
Closed

online表单数据源配置,不支持数据库密码加密 #2672

tuikoushui opened this issue Jun 18, 2021 · 1 comment

Comments

@tuikoushui
Copy link

版本号:2.4.5
问题描述:

不支持开发手册中的druid原生的密码加密方式
和springboot+dynamic-datasource-starter原生的ENC(password)方式,只能使用明文密码。
目前只能在org.jeecg.config.init.CodeGenerateDbConfig类中,添加解密代码。

截图&代码:
package org.jeecg.config.init;

import com.alibaba.druid.filter.config.ConfigTools;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecgframework.codegenerate.database.CodegenDatasourceConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description: 代码生成器,自定义DB配置
 * 【加了此类,则online模式DB连接,使用平台的配置,jeecg_database.properties配置无效;
 *  但是使用GUI模式代码生成,还是走jeecg_database.properties配置】
 * @author: scott
 * @date: 2021年02月18日 16:30
 */
@Slf4j
@Configuration
public class CodeGenerateDbConfig {
    @Value("${spring.datasource.dynamic.datasource.master.url:}")
    private String url;
    @Value("${spring.datasource.dynamic.datasource.master.username:}")
    private String username;
    @Value("${spring.datasource.dynamic.datasource.master.password:}")
    private String password;
    @Value("${spring.datasource.dynamic.datasource.master.druid.public-key:}")
    private String publicKey;
    @Value("${spring.datasource.dynamic.datasource.master.driver-class-name:}")
    private String driverClassName;


    @Bean
    public CodeGenerateDbConfig initCodeGenerateDbConfig() {
        if(StringUtils.isNotBlank(url)){
            if(StringUtils.isNotBlank(publicKey)){
                try {
                    password = ConfigTools.decrypt(publicKey, password);
                } catch (Exception e) {
                    e.printStackTrace();
                    log.error(" 代码生成器数据库连接,数据库密码解密失败!");
                }
            }
            CodegenDatasourceConfig.initDbConfig(driverClassName,url, username, password);
            log.info(" 代码生成器数据库连接,使用application.yml的DB配置 ###################");
        }
        return null;
    }
}
@zhangdaiscott
Copy link
Member

收录你的方案,代码生成器底层暂时不做太多修改

gagaboy added a commit to gagaboy/jeecg-boot that referenced this issue Jun 29, 2021
* commit '37fe6fea693de5efaf36feb46d2c3816744e16e7': (27 commits)
  表字典接口存在SQL注入漏洞,增加签名拦截器 自定义组件验签失败 issues/I3XNK1
  登录账号提示修改
  HW21-0499 表字典接口存在SQL注入漏洞,增加签名拦截器
  HW21-0499 表字典接口存在SQL注入漏洞,增加签名拦截器
  HW21-0499 表字典接口存在SQL注入漏洞,增加签名拦截器
  online表单数据源配置,数据库类型识别错误 jeecgboot#2671
  online表单数据源配置,不支持数据库密码加密 jeecgboot#2672
  群满,加新群 ④774126647
  【gitee/I3HTFI】自定义树控件的表单里的外键直接显示id不显示name 新增监控在线用户 阿里监控去掉广告
  解决issue#2639 2.4.5升级后出现后端排序报错
  用户添加页面无法修改手机号
  JeecgBoot低代码平台 2.4.5 版本发布,钉钉与企业微信集成版本
  JeecgBoot低代码平台 2.4.5 版本发布,钉钉与企业微信集成版本
  JeecgBoot低代码平台 2.4.5 版本发布,钉钉与企业微信集成版本
  JeecgBoot低代码平台 2.4.5 版本发布,钉钉与企业微信集成版本
  JeecgBoot低代码平台 2.4.5 版本发布,钉钉与企业微信集成版本
  JeecgBoot低代码平台 2.4.5 版本发布,钉钉与企业微信集成版本
  JeecgBoot低代码平台 2.4.5 版本发布,钉钉与企业微信集成版本
  JeecgBoot低代码平台 2.4.5 版本发布,钉钉与企业微信集成版本
  JeecgBoot低代码平台 2.4.5 版本发布,钉钉与企业微信集成版本
  ...

# Conflicts:
#	ant-design-vue-jeecg/package-lock.json
#	ant-design-vue-jeecg/package.json
#	ant-design-vue-jeecg/src/components/layouts/TabLayout.vue
#	ant-design-vue-jeecg/src/components/menu/SideMenu.vue
#	ant-design-vue-jeecg/src/components/page/GlobalHeader.vue
#	ant-design-vue-jeecg/src/components/page/GlobalLayout.vue
#	ant-design-vue-jeecg/src/components/tools/UserMenu.vue
#	ant-design-vue-jeecg/src/views/system/modules/UserModal.vue
#	ant-design-vue-jeecg/src/views/user/Login.vue
#	jeecg-boot/cucc-csp-platform/src/main/resources/application-dev.yml
EightMonth pushed a commit to EightMonth/jeecg-boot that referenced this issue Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants