ulisesbocchio / jasypt-spring-boot

Jasypt integration for Spring boot
MIT License
2.91k stars 522 forks source link

Add configuration to cache decrypted value #41

Closed jefferyyuan closed 7 years ago

jefferyyuan commented 7 years ago

I am not sure but seems to me that decrypt is expensive. So it would be great if jasypt-spring-boot can cache the already decrypted value in DefaultPropertyResolver.

https://github.com/ulisesbocchio/jasypt-spring-boot/blob/master/jasypt-spring-boot/src/main/java/com/ulisesbocchio/jasyptspringboot/resolver/DefaultPropertyResolver.java

com.ulisesbocchio.jasyptspringboot.resolver.DefaultPropertyResolver.resolvePropertyValue(String)

ulisesbocchio commented 7 years ago

While true, caching sensitive passwords or whatever your keeping encrypted is a security vulnerability. Ideally you'll request the property once and dispose it. If you want to cache them yourself you can simply override the StringEncryptor bean with a decorator one that wraps a real one and does the caching.