Comments (10)
Let me take a look and I'll get back to you.
Thanks,
Uli
from jasypt-spring-boot.
I believe this is what you're looking for: spring-projects/spring-boot@055ace3
Basically, Spring added Logback support for doing this in your logback configuration:
<configuration>
...
<springProperty name="destination" source="my.loggger.extradest"/>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${destination}</file>
...
</file>
</appender>
...
</configuration>
from jasypt-spring-boot.
Hi Ulises,
Thank you very much for coming back to me.
The setting that you mentionned above is indeed what I'm using in my logback file.
The problem is that the encrypted spring properties don't seem to be decrypted on-the-fly (in my personal case, I just have jasypt-spring-boot jar as a maven dependency, a "@SpringBootApplication" annotation and an application.yml resource file with encrypted properties).
Does on-the-fly property-decryption work for you inside a logback-spring config file ?
Thank you very much in advance for your expertise.
Best Regards
from jasypt-spring-boot.
Hmm... That's interesting, I was betting on it working, but let me do some debugging with logback configuration. I haven't really tried your scenario. Do you happen to have some sort of demo app where the issue manifests that I can checkout from GitHub?
Best,
Uli
from jasypt-spring-boot.
In order to reproduce the issue, you can use for example Spring demo project " Serving Web Content with Spring MVC" under https://spring.io/guides then the 3 following steps:
-
add jasypt-spring-boot-starter jar to your dependencies
-
add a "application.yml" file like:
jasypt.encryptor.password: your_encryption_key_here
encryptedproperty: ENC(your_encrypted_value_here)
- a logback-spring.xml file like:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<springProperty scope="context" name="encryptedproperty" source="encryptedproperty"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%property{encryptedproperty} %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT" />
</root>
</configuration>
from jasypt-spring-boot.
You'll have to use another type of setup. Spring is loading Logging configuration very early on the bootstrap process, way before this plugin decorates properties using a bean post processor. I just released a new version of the plugin (1.7) that will allow you to define a custom Environment in your application this way:
new SpringApplicationBuilder()
.environment(new EncryptableEnvironment(new StandardServletEnvironment()))
.sources(YourApplicationClass.class).run(args);
The new environment basically decorates the StandardServletEnvironment, or any other ConfigurableEnvironment implementation. With this setup, you do not need to use the starter jar, just jasypt-string-boot, but it has it's limitations. For configuration, You'd have to pass the encryption password as a system property and any other configuration for the StringEncryptor that's available as a property. Or, you can populate the properties in the decorated environment, by either directly adding a property source to the decorated environment, or by setting the properties in the SpringApplicationBuilder.
Otherwise, if you want to provide your own StringEncryptor, you could use the other constructor:
StringEncryptor encryptor = ...;
new SpringApplicationBuilder()
.environment(new EncryptableEnvironment(new StandardServletEnvironment(), encryptor))
.sources(YourApplicationClass.class).run(args);
But it'd be up to you how you initialize the string encryptor.
from jasypt-spring-boot.
Perfect ! :-)
Thanks a lot for your expertise and your time, Ulises !
from jasypt-spring-boot.
No worries, thanks for using the library!
from jasypt-spring-boot.
In case you find time to answer:
how long will it take for the new binaries to be available (and visible) in maven central ?
from jasypt-spring-boot.
I can see it now in Maven central ! :-)
from jasypt-spring-boot.
Related Issues (20)
- Cause Spring Boot's configuration replacement to fail HOT 3
- I use a Gradle Project. Is this plugin just for maven project?
- I use a Gradle Project. Is this plugin just for maven project? HOT 1
- Spring RabbitMQ credentials can't be encrypted
- Create custom encryptor bean with an error HOT 4
- Password rotation possibility HOT 4
- jasypt-spring-boot 3.0.5 doesn't work with spring boot 2.3.12.RELEASE HOT 1
- Multiple property decryption
- proxy-property-sources=true causes ClassCastException HOT 1
- [BUG] in springboot 2.0.3,the "spring.config.name" properties lose efficacy
- JASYPT fails to bind properties 'spring.datasource.password' while using with ENC() HOT 1
- Is there an unresolvable circular reference HOT 3
- 3.x.x 以后可以自定义加密器吗,配置jasypt.encryptor.bean的方式
- GraalVM native app startup with errors. HOT 1
- Windows and Linux compatibility issues HOT 3
- AES256GCM, Base64 decod of key file failed...
- StackOverflowError with SpringBoot 3.1.5 and jasypt-spring-boot-starter 3.0.5 with ${cors.origins.allowed:#{http://localhost:4200}} HOT 2
- jasypt not decrypting already encrypted property (i.e in application.properties file) in xml based configuration spring boot project HOT 3
- Usage of StandardEncryptableEnvironment with additional active profile(s) and custom prefix and suffix breaks decryption
- String Encryptor custom Bean not found with name 'jasyptStringEncryptor' after upgrading to AWS CLOUD Spring3(implementation platform("io.awspring.cloud:spring-cloud-aws-dependencies:3.0.4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jasypt-spring-boot.