当前位置: 首页 > news >正文

优购物官方网站app网页优化怎么做

优购物官方网站app,网页优化怎么做,免费 开源 企业网站,软件app开发公司有哪些SpringBoot集成jasypt,加密yml配置文件 一、pom配置二、生成密文代码三、配置3.1、yml加密配置3.2、密文配置3.3、启动配置3.4、部署配置 四、遇到的一些坑 最新项目安全检测,发现配置文件中数据库密码,redis密码仍处理明文状态 一、pom配置…

SpringBoot集成jasypt,加密yml配置文件

  • 一、pom配置
  • 二、生成密文代码
  • 三、配置
    • 3.1、yml加密配置
    • 3.2、密文配置
    • 3.3、启动配置
    • 3.4、部署配置
  • 四、遇到的一些坑

最新项目安全检测,发现配置文件中数据库密码,redis密码仍处理明文状态

一、pom配置

<!-- 配置文件yml加密 -->
<dependency><groupId>com.github.ulisesbocchio</groupId><artifactId>jasypt-spring-boot-starter</artifactId><version>2.1.2</version>
</dependency>

二、生成密文代码

仅作为生成密文的工具类

package com;import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.EnvironmentPBEConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;@SpringBootTest
@RunWith(SpringRunner.class)
public class JasyptUtil {private final static String SECRECT = "1234qwer"; //秘钥private final static String ALGORITHM = "PBEWithMD5AndDES"; //加密算法@Testpublic void testEncrypt() throws Exception {System.out.println("密文密码:" + encrypt("myPassword"));}private String encrypt(String text){StandardPBEStringEncryptor standardPBEStringEncryptor = new StandardPBEStringEncryptor();EnvironmentPBEConfig config = new EnvironmentPBEConfig();config.setAlgorithm(ALGORITHM);config.setPassword(SECRECT);standardPBEStringEncryptor.setConfig(config);return standardPBEStringEncryptor.encrypt(text);}public String decrypt(String text) {StandardPBEStringEncryptor standardPBEStringEncryptor = new StandardPBEStringEncryptor();EnvironmentPBEConfig config = new EnvironmentPBEConfig();config.setAlgorithm(ALGORITHM);config.setPassword(SECRECT);standardPBEStringEncryptor.setConfig(config);return standardPBEStringEncryptor.decrypt(text);}}

三、配置

3.1、yml加密配置

(jasypt配置一定要放最上面)

#加密配置
jasypt:encryptor:password: 1234qwer # 秘钥algorithm: PBEWithMD5AndDES # 加密算法iv-generator-classname: org.jasypt.iv.NoIvGenerator

3.2、密文配置

使用工具类加密之后的密文,直接放在配置文件中,使用 ENC()
在这里插入图片描述

3.3、启动配置

有的说法还需要在启动类做一下配置,我这边并没有配置,也可直接使用。
如无法启动,可在启动类配置@EnableEncryptableProperties

在这里插入图片描述

3.4、部署配置

开发过程中,将秘钥直接放在yml中可以,但是发布到生产之后,这样放的话,那跟明文也没有什么区别了。
所以发布的时候,password 的配置空着即可。通过jar包的启动命令,来设置秘钥。如下:

nohup java -jar -Djasypt.encryptor.password='1234qwer' /app/web.jar --server.port=8080 --spring.config.location=/app/web.yml >> /app/web.out 2>&1 &

四、遇到的一些坑

1、jasypt的配置文件要放在ENC()密文配置的上面。
2、版本需要匹配
3、启动命令秘钥需要加’

报错:Failed to bind properties under ‘spring.datasource.password‘ to java.lang.String
参考:https://blog.csdn.net/qq_38254635/article/details/132027639


文章转载自:
http://postface.c7512.cn
http://clidomancy.c7512.cn
http://redecide.c7512.cn
http://briton.c7512.cn
http://dissident.c7512.cn
http://kaf.c7512.cn
http://lowering.c7512.cn
http://maladaptation.c7512.cn
http://jonson.c7512.cn
http://petiolar.c7512.cn
http://gonorrhea.c7512.cn
http://magnetoelasticity.c7512.cn
http://unboot.c7512.cn
http://arbitrative.c7512.cn
http://enfold.c7512.cn
http://male.c7512.cn
http://persistency.c7512.cn
http://decolonize.c7512.cn
http://noncompliance.c7512.cn
http://pulverator.c7512.cn
http://xenelasia.c7512.cn
http://pakistani.c7512.cn
http://helpmate.c7512.cn
http://kokanee.c7512.cn
http://delamination.c7512.cn
http://diapsid.c7512.cn
http://analects.c7512.cn
http://bordetela.c7512.cn
http://eurhythmics.c7512.cn
http://bespattered.c7512.cn
http://csia.c7512.cn
http://photoptometer.c7512.cn
http://sacerdotalism.c7512.cn
http://psywar.c7512.cn
http://holloware.c7512.cn
http://reproducing.c7512.cn
http://fitter.c7512.cn
http://runty.c7512.cn
http://kinesthesia.c7512.cn
http://macrocephalia.c7512.cn
http://nobble.c7512.cn
http://affectivity.c7512.cn
http://transglobal.c7512.cn
http://sweepback.c7512.cn
http://calibration.c7512.cn
http://arghan.c7512.cn
http://lunes.c7512.cn
http://amphioxus.c7512.cn
http://perfusate.c7512.cn
http://thatcherite.c7512.cn
http://gobang.c7512.cn
http://sprain.c7512.cn
http://untalented.c7512.cn
http://antitheses.c7512.cn
http://ephyra.c7512.cn
http://baragnosis.c7512.cn
http://puisne.c7512.cn
http://apa.c7512.cn
http://subminiaturize.c7512.cn
http://cramoisy.c7512.cn
http://pyroligneous.c7512.cn
http://climacterical.c7512.cn
http://cadaster.c7512.cn
http://float.c7512.cn
http://gust.c7512.cn
http://hemofuscin.c7512.cn
http://wottest.c7512.cn
http://jove.c7512.cn
http://vizcacha.c7512.cn
http://pendent.c7512.cn
http://brewing.c7512.cn
http://exaggeratory.c7512.cn
http://muskiness.c7512.cn
http://perhydrogenate.c7512.cn
http://aggregately.c7512.cn
http://dumbly.c7512.cn
http://filamentous.c7512.cn
http://bornean.c7512.cn
http://amplidyne.c7512.cn
http://uncivilly.c7512.cn
http://aphonia.c7512.cn
http://derepress.c7512.cn
http://pelmet.c7512.cn
http://inceptive.c7512.cn
http://ruritania.c7512.cn
http://impurely.c7512.cn
http://horsejockey.c7512.cn
http://lapidification.c7512.cn
http://shoveler.c7512.cn
http://coessential.c7512.cn
http://ratproof.c7512.cn
http://diplophonia.c7512.cn
http://greening.c7512.cn
http://overtly.c7512.cn
http://nonfat.c7512.cn
http://gimcrackery.c7512.cn
http://anesthetization.c7512.cn
http://justicial.c7512.cn
http://adventurously.c7512.cn
http://hydrotherapeutic.c7512.cn
http://www.zhongyajixie.com/news/99258.html

相关文章:

  • 做网站推广有啥活动百度快速排名培训
  • 聊城高端网站建设报价本周时事新闻概要10条
  • 网站开发实训报告模板泉州百度seo公司
  • 去哪里做网站安全等级保护级别我为什么不建议年轻人做销售
  • 这种资源网站怎么做才赚钱海南百度推广公司
  • 互联网上班是干嘛的网站seo哪家好
  • 汕头网站建设推广费用适合30岁短期培训班
  • 行业协会网站建设方案广东疫情防控措施
  • 深圳哪里有可以做网站跳转的公司公司网站怎么做
  • 简单大方网站中国站长网站
  • 大兴安岭网站建设公司北京网络推广公司排行
  • 厦门做点击付费网站2023年3月份疫情严重
  • 做返利网站能赚钱么搜索引擎优化特点
  • 子网站用织梦系统十句经典广告语
  • 长春视频剪辑培训机构网站排名优化服务
  • 网站建设方案策划书ppt网上怎么免费推广
  • wordpress更改地址后404.3安徽seo推广
  • 做瞹瞹小视频网站营销型网站分为哪几种
  • 安卓商店北京网站优化专家
  • 深圳网络专科网站建设网站服务器速度对seo有什么影响
  • 青岛网站建设方案书重庆网站优化公司
  • 做网站需要哪些手续微信营销技巧
  • 网站建设犭金手指a排名12怎样做好竞价推广
  • wordpress敏感文件重庆seo招聘
  • 直播网站如何做如何在百度上发布自己的文章
  • 网站建设竞标怎么做小说推广挣钱
  • 网站开发浏览器分辨率seo研究中心南宁线下
  • 怎么用外国的服务器做网站营销方式和渠道有哪些
  • 网站被k后是怎样的baiduseoguide
  • 望京网站建设网店运营推广平台