From 43b76e55849a660fb2caa0928320fa07ceca8f8a Mon Sep 17 00:00:00 2001 From: Salman Manoe Date: Wed, 24 Jan 2024 19:24:08 +0700 Subject: [PATCH] Update JasyptConfig.java --- Medifirst2000/pom.xml | 32 ++++++++-------- .../medifirst2000/util/JasyptConfig.java | 38 +++++++++++++++++++ jasamedika-config/pom.xml | 5 +++ 3 files changed, 60 insertions(+), 15 deletions(-) create mode 100644 jasamedika-business/src/main/java/com/jasamedika/medifirst2000/util/JasyptConfig.java diff --git a/Medifirst2000/pom.xml b/Medifirst2000/pom.xml index cd664a2b..a6105582 100644 --- a/Medifirst2000/pom.xml +++ b/Medifirst2000/pom.xml @@ -74,6 +74,7 @@ 1.42.0 1.18.28 + 1.7 10000 @@ -99,20 +100,34 @@ slf4j-api ${org.slf4j.version} + + joda-time + joda-time + ${joda-time.version} + + + org.apache.poi + poi + ${poi.version} + + + com.github.ulisesbocchio + jasypt-spring-boot-starter + ${ulisesbocchio.jasypt.version} + + org.slf4j jcl-over-slf4j ${org.slf4j.version} runtime - org.slf4j log4j-over-slf4j ${org.slf4j.version} runtime - ch.qos.logback logback-classic @@ -120,25 +135,12 @@ runtime - - joda-time - joda-time - ${joda-time.version} - - - - org.apache.poi - poi - ${poi.version} - - junit junit ${junit.version} test - Jasa Medika diff --git a/jasamedika-business/src/main/java/com/jasamedika/medifirst2000/util/JasyptConfig.java b/jasamedika-business/src/main/java/com/jasamedika/medifirst2000/util/JasyptConfig.java new file mode 100644 index 00000000..92eb3b78 --- /dev/null +++ b/jasamedika-business/src/main/java/com/jasamedika/medifirst2000/util/JasyptConfig.java @@ -0,0 +1,38 @@ +package com.jasamedika.medifirst2000.util; + +import com.ulisesbocchio.jasyptspringboot.annotation.EncryptablePropertySource; +import com.ulisesbocchio.jasyptspringboot.annotation.EncryptablePropertySources; +import org.jasypt.encryption.StringEncryptor; +import org.jasypt.encryption.pbe.PooledPBEStringEncryptor; +import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @author salmanoe + * @version 1.0.0 + * @since 23/01/2024 + */ +@Configuration +@EncryptablePropertySources({@EncryptablePropertySource("classpath:jdbc.bridging.properties"), + @EncryptablePropertySource("classpath:jdbc.cssd.properties"), + @EncryptablePropertySource("classpath:jdbc.development.properties"), + @EncryptablePropertySource("classpath:jdbc.ip3rs.properties"), + @EncryptablePropertySource("classpath:jdbc.it.properties"), + @EncryptablePropertySource("classpath:jdbc.k3kl.properties"), + @EncryptablePropertySource("classpath:jdbc.laundry.properties"), + @EncryptablePropertySource("classpath:jdbc.localhost.properties"), + @EncryptablePropertySource("classpath:jdbc.mirroring.properties"), + @EncryptablePropertySource("classpath:jdbc.pelayanan.properties"), + @EncryptablePropertySource("classpath:jdbc.sdm.properties"), + @EncryptablePropertySource("classpath:jdbc.web.properties")}) +public class JasyptConfig { + @Bean + public StringEncryptor jasyptStringEncryptor() { + String password = System.getProperty("jasypt.encryptor.password"); + PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); + SimpleStringPBEConfig config = new SimpleStringPBEConfig(); + config.setPassword(password); + return encryptor; + } +} diff --git a/jasamedika-config/pom.xml b/jasamedika-config/pom.xml index 9a09dcc1..d4da22f8 100644 --- a/jasamedika-config/pom.xml +++ b/jasamedika-config/pom.xml @@ -109,6 +109,11 @@ 1.8 + + com.github.ulisesbocchio + jasypt-maven-plugin + 3.0.0 + Module Medifirst2000 untuk Configuration