Giter VIP home page Giter VIP logo

springboot-jasypt's Introduction

springboot-jasypt's People

Contributors

choisungwook avatar

Watchers

James Cloos avatar  avatar  avatar

springboot-jasypt's Issues

Junit Test

@SpringBootTest
@Slf4j
class JasyptApplicationTests {
	@Autowired
	private StringEncryptor jasyptStringEncryptor;

	@Test
	void contextLoads() {
	}

	@Test
	public void testEncrypt(){
		String target_text = "theValueYouWantToEncrypt";

		String enc_text = jasyptStringEncryptor.encrypt(target_text);
		log.info(enc_text);

		String decText = jasyptStringEncryptor.decrypt(enc_text);
		Assertions.assertThat(decText).isEqualTo(target_text);
	}

}

jasypt maven dependency 추가

  • dependency 추가
<dependency>
        <groupId>com.github.ulisesbocchio</groupId>
        <artifactId>jasypt-spring-boot-starter</artifactId>
        <version>3.0.3</version>
</dependency>
  • plugin 추가
<build>
		<plugins>
			<plugin>
				<groupId>com.github.ulisesbocchio</groupId>
				<artifactId>jasypt-maven-plugin</artifactId>
				<version>3.0.3</version>
			</plugin>
			<plugin>
                            ...
			</plugin>
		</plugins>
	</build>

dependency 전체 목록

  • jpa
  • mariadb-java-client
  • jasypt-spring-boot-starter
<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
		</dependency>
		<dependency>
			<groupId>com.github.ulisesbocchio</groupId>
			<artifactId>jasypt-spring-boot-starter</artifactId>
			<version>3.0.3</version>
		</dependency>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client -->
		<dependency>
			<groupId>org.mariadb.jdbc</groupId>
			<artifactId>mariadb-java-client</artifactId>
			<version>2.7.0</version>
		</dependency>
</dependencies>

암호화 예제 실행

준비

Issue #1 참고

암호화 예제

mvn jasypt:encrypt-value -D'jasypt.encryptor.password="the password"' -D'jasypt.plugin.value="theValueYouWantToEncrypt"'

image

복호화 예제

mvn jasypt:decrypt-value -D'jasypt.encryptor.password="the password"' -D'jasypt.plugin.value="RYuChA4G/+r1r2c8m0pgOAb7AOXJnoSr5SkYiVqmj0Sr5292Y8K8q8VFmhTB+bciwgAYPlgopFH4CKYNXQbqWA=="'

image

참고자료

JPA DB연결정보

  • application.yaml설정
spring:
  datasource:
    url: jdbc:mariadb://localhost:<포트번호>/<db이름>
    driver-class-name: org.mariadb.jdbc.Driver
    username: <계정이름>
    password: <비밀번호>
  jpa:
    open-in-view: false
    generate-ddl: true
    show-sql: true
    hibernate:
      ddl-auto: update

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.